简体   繁体   English

WCF上的maxStringContentLength问题

[英]Issue with maxStringContentLength on WCF

I have inherited a WCF web service which is running ASP.Net 2 on IIS 7. 我继承了在IIS 7上运行ASP.Net 2的WCF Web服务。

However, we have a problem when posting large amounts of data, it produces an error 400 Bad Request. 但是,发布大量数据时我们遇到了问题,它会产生错误400 Bad Request。

I've added element, as a trace is producing the following error 我添加了元素,因为跟踪产生以下错误

"There was an error deserializing the object of type CIX.API.Contracts.PostMessage. The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader. Line 51, position 322." “反序列化CIX.API.Contracts.PostMessage类型的对象时发生错误。读取XML数据时,超出了最大字符串内容长度配额(8192)。可以通过更改所使用的XmlDictionaryReaderQuotas对象上的MaxStringContentLength属性来增加此配额。创建XML阅读器时。第51行,位置322。”

I've included the whole system.serviceModel below - can anyone spot anything that's amiss? 我在下面包括了整个system.serviceModel-有人可以发现不对的地方吗? I've been trying to fix this for some time, but I've been unable to and any help would be very much appreciated. 我一直在尝试解决此问题,但是我一直无法解决,任何帮助将不胜感激。

<diagnostics>
    <messageLogging logMessagesAtTransportLevel="true" logMessagesAtServiceLevel="false" logMalformedMessages="true" logEntireMessage="true" maxSizeOfMessageToLog="65535000" maxMessagesToLog="500" />
</diagnostics>
<extensions>
  <behaviorExtensions>
    <add name="restHttpBehavior" type="CIX.API.Behaviors.ErrorHandling.RestBehaviorExtension, CIX.API, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" />
  </behaviorExtensions>
  <bindingElementExtensions>
    <add name="secureCIXChannel" type="CIX.API.Channels.SecureCIX.SecureCIXBindingExtension, CIX.API, Version=2.0.0.0, Culture=neutral" />
    <add name="hlRestChannel" type="CIX.API.Channels.HLRest.HLBindingExtension, CIX.API" />
  </bindingElementExtensions>
</extensions>
<services>
  <service behaviorConfiguration="CIX.API.ServiceBehavior" name="CIX.API.CIX">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost/API/" />
      </baseAddresses>
    </host>
    <endpoint contract="CIX.API.ICIX" address="" binding="customBinding" bindingConfiguration="CIXBinding" behaviorConfiguration="CIX.API.CIXBehavior" />
  </service>
</services>
<bindings>
  <customBinding>
    <binding name="CIXBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
      <secureCIXChannel />
      <webMessageEncoding>
        <readerQuotas MaxStringContentLength="2147483647" />
      </webMessageEncoding>       
      <httpTransport manualAddressing="true" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
    </binding>  
  </customBinding>
</bindings>
<behaviors>
  <endpointBehaviors>
    <behavior name="CIX.API.CIXBehavior">
      <dataContractSerializer maxItemsInObjectGraph="200000" />
      <!--<webHttp />-->
      <restHttpBehavior />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="CIX.API.ServiceBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
    <behavior name="CIX.Web.CIXBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>

Leslie 莱斯利

另外,尝试将maxArrayLength =“ 2147483647” maxBytesPerRead =“ 2147483647”添加到阅读器quota。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM