WCF上maxStringContentLength的问题
本文关键字:问题 maxStringContentLength WCF | 更新日期: 2023-09-27 17:53:16
我继承了一个运行ASP的WCF web服务。.
然而,我们有一个问题,当张贴大量的数据,它产生一个错误400 Bad Request.
我已经添加了元素,因为跟踪会产生以下错误
"反序列化CIX.API.Contracts.PostMessage类型的对象出错。读取XML数据时已超过最大字符串内容长度配额(8192)。可以通过更改创建XML阅读器时使用的xmldictionaryreaderquota对象上的MaxStringContentLength属性来增加此配额。51行,位置322。"
我已经包括了整个系统。下面的serviceModel -有人能发现任何错误吗?我一直在试图解决这个问题,但我一直无法,任何帮助将非常感激。
<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>
莱斯利
还可以尝试在readerquota中添加maxArrayLength="2147483647" maxBytesPerRead="2147483647"。