【问题标题】:WCF: The maximum string content length quota (8192) has been exceeded. Readquota not workingWCF:已超出最大字符串内容长度配额 (8192)。阅读配额不起作用
【发布时间】:2013-06-13 09:34:36
【问题描述】:

我们遇到了以下错误:

读取 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>

【问题讨论】:

标签: ajax wcf web-config


【解决方案1】:

您必须将 server 和 client 上的 MaxStringContentLength 更改为更大的值,例如 8192。您仅更改为服务器端的值。因此,请查看您的客户端配置以修复您的错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-15
    • 1970-01-01
    相关资源
    最近更新 更多