无法增加最大字符串内容长度配额(8192)

时间:2013-05-08 10:07:35

标签: wcf

我和我的同事一直在试图解决向网络服务发送超过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>

1 个答案:

答案 0 :(得分:0)

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

WCF Tracing MSDN

相关问题