我在服务上做了所有正确的设置,但当我尝试将大量JSON数据发送到我的WCF REST服务时,仍然得到相同的愚蠢400错误请求。以下是我的服务Web.config。我已经为此挣扎了3周,并没有找到答案。这是从响应异常详细信息:。将大量JSON数据发送到WCF ReST服务时收到400错误请求
“发生错误反序列化类型BuildStepResource的 对象的 最大字符串内容而读 XML数据长度配额 (8192)已被超过此配额可通过在创建XML阅读器时更改 XmlDictionaryReaderQuotas对象使用的 上的MaxStringContentLength 属性来增加 。
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<bindings>
<webHttpBinding>
<binding name="nonSSLBinding" maxReceivedMessageSize="4194304" receiveTimeout="01:00:00" sendTimeout="01:00:00" >
<security mode="None">
<transport clientCredentialType="Ntlm"/>
</security>
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
</binding>
<binding name="sslBinding" maxReceivedMessageSize="4194304" receiveTimeout="01:00:00" sendTimeout="01:00:00" >
<security mode="Transport">
<transport clientCredentialType="Basic"/>
</security>
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
</binding>
</webHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="webBehavior" name="serviceEndpoints">
<endpoint address="" binding="webHttpBinding" contract="ISWCRestService" bindingConfiguration="nonSSLBinding" behaviorConfiguration="customBehavior"/>
<endpoint address="" binding="webHttpBinding" contract="ISWCRestService" bindingConfiguration="sslBinding" behaviorConfiguration="customBehavior"/>
<endpoint address="" binding="webHttpBinding" contract="IXmlEndpoint" bindingConfiguration="nonSSLBinding" behaviorConfiguration="customBehavior"/>
<endpoint address="" binding="webHttpBinding" contract="IXmlEndpoint" bindingConfiguration="sslBinding" behaviorConfiguration="customBehavior"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="webBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483646" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="customBehavior">
<webHttp automaticFormatSelectionEnabled="false" helpEnabled="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483646" />
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
你有没有解决这个问题?我一直面临类似的问题。 – jcreamer898