我继承了一个在IIS 7上运行ASP.Net 2的WCF Web服务。
但是,我们在发布大量数据时遇到问题,它会产生错误400 Bad Request。
我添加了元素,因为跟踪产生了以下错误
"反序列化CIX.API.Contracts.PostMessage类型的对象时出错。读取XML数据时已超出最大字符串内容长度配额(8192)。通过更改创建XML阅读器时使用的XmlDictionaryReaderQuotas对象的MaxStringContentLength属性,可以增加此配额。第51行,第322位。"
我已经包含了下面的整个system.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>
莱斯利
答案 0 :(得分:0)
另请尝试将maxArrayLength =“2147483647”maxBytesPerRead =“2147483647”添加到readerquota。