缓冲XML内容所需的大小超过了缓冲区配额

时间:2011-10-12 06:01:55

标签: c# asp.net wcf

我收到错误

  

缓冲XML内容所需的大小超过了缓冲区配额。

在SQL Server中运行存储过程时从WCF。它工作正常,但在实时项目中它会抛出错误。

任何解决方案?我在我的应用程序中进行了以下设置,此WCF消耗了这些设置。

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IApicaAzureMonitorAgentReceiverWCF"
      closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00"
      sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false"
      hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647"
      maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://localhost:61803/ApicaAzureMonitorAgentReceiverWCF.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IApicaAzureMonitorAgentReceiverWCF"
    contract="Dashboard2WCFData.IApicaAzureMonitorAgentReceiverWCF"
    name="BasicHttpBinding_IApicaAzureMonitorAgentReceiverWCF" />
</client>
</system.serviceModel>

在WCF的web.config我有以下设置。

<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceThrottling maxConcurrentSessions="2147483647" maxConcurrentInstances="2147483647" />
      <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

1 个答案:

答案 0 :(得分:0)

尝试通过附加流程将WCF与消费者应用程序连接,然后根据我的情况,我可以从WCF异常中获取确切的错误原因Getting Error : The size necessary to buffer the XML content exceeded the buffer quota