WCF:更改maxStringContentLength

时间:2013-04-02 06:05:49

标签: wcf

我需要将maxStringContentLength更改为大于8192的值但尚未成功执行此操作。如果收到的数据量大于8192字节,我的WCF服务将生成异常。我已经用尽了我的搜索,似乎没有任何帮助。我应该指出异常来自服务器。忘记客户端,因为我看到直接从服务器上的WCF生成的异常。这是我的web.config设置:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
  </system.web>
  <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"/>
          <!-- 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>
    <bindings>
      <basicHttpBinding>
        <binding name="defaultBinding">
          <readerQuotas maxStringContentLength="1048576" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

0 个答案:

没有答案