【问题标题】:Unable To Increase Maximum String Content Length Quota (8192)无法增加最大字符串内容长度配额 (8192)
【发布时间】:2013-05-08 10:07:35
【问题描述】:

我和我的同事一直在努力解决向 Web 服务发送超过 8192 字节数据的问题。我尝试创建一个简单的 WCF 项目来测试发送一些数据,但它仍然在 8192+ 字节时失败。我已经阅读了数百个网页并对 web.config 文件进行了更改,以确保元素足够大,但仍然无法正常工作。

任何建议将不胜感激。

我们正在使用本地主机上的 IIS Express 作为 Web 服务器测试服务,并使用 WCFTestClient 将数据发送到服务。我们还尝试使用 Storm 作为客户端向 Web 服务发送数据。

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <client>
      <endpoint binding="basicHttpBinding" bindingConfiguration="NewBinding0"
        contract="IService1" name="ClientEndPointName" />
    </client>
    <services>
      <service name="Service1">
        <endpoint address="http://localhost:2787" binding="basicHttpBinding"
          bindingConfiguration="NewBinding0" name="DROServiceX" bindingName="DROBindingName"
          contract="IService1" isSystemEndpoint="false" />
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="NewBinding0" transferMode="Buffered">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
        maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <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"/>
         <!-- 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 -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false"
  multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>

【问题讨论】:

  • 客户端也有各种超时和限制。你配置好了吗?
  • 其他SO thread 可能会有所帮助。

标签: wcf


【解决方案1】:

您应该在服务器端和客户端进行配置。如果其中之一未正确配置,则请求将失败。您的服务器配置正确,因此您应该查看客户端配置。如果您真的知道发生了什么,请启动 WCF 跟踪以查看发生了什么。

WCF Tracing MSDN

【讨论】:

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