WCF:已超出最大字符串内容长度配额(8192)。 Readquota不工作

时间:2013-06-13 09:34:37

标签: ajax wcf web-config

我们在遇到以下错误时遇到了一些问题:

读取XML数据时已超出最大字符串内容长度配额(8192)。通过更改创建XML阅读器时使用的XmlDictionaryReaderQuotas对象的MaxStringContentLength属性,可以增加此配额。

现在我们发现有很多线程正在讨论编辑web.config,以及我们做过的事情,但这似乎对我们的情况没有帮助。

我们正在对我们的wcf服务进行ajax POST,我们可以看到服务器接收数据。 谁有解决方案?

<system.serviceModel>
  <bindings>
    <webHttpBinding>
      <binding name="BIS.HttpBinding" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
        maxReceivedMessageSize="2147483647" transferMode="Buffered">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
          maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
      </binding>
    </webHttpBinding>
  </bindings>
  <services>
    <service name="QNH.Transponder.BIS.BISService"  behaviorConfiguration="BIS.ServiceBehavior">
      <endpoint address="" behaviorConfiguration="BIS.EndpointBehavior" binding="webHttpBinding" bindingConfiguration="BIS.HttpBinding" contract="QNH.Transponder.BIS.IBISService" />
    </service>
  </services>
  <behaviors>
    <endpointBehaviors>
      <behavior name="BIS.EndpointBehavior">
        <dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="2147483647" />
        <webHttp />
      </behavior>
    </endpointBehaviors>
    <serviceBehaviors>
      <behavior name="BIS.ServiceBehavior">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="true" />
        <dataContractSerializer ignoreExtensionDataObject="true" maxItemsInObjectGraph="2147483647" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>

1 个答案:

答案 0 :(得分:2)

您必须将服务器客户端上的MaxStringContentLength更改为更大的值8192.您只需在服务器端更改为值。因此,请查看您的客户端配置以修复错误。

相关问题