我需要将 maxStringContentLength 更改为大于 8192 的值,但没有成功。如果我的 WCF 服务接收到的数据量大于 8192 字节,它将生成异常。我已经用尽了我的搜索,似乎没有任何帮助。我应该指出,异常来自服务器。忘记客户端,因为我看到服务器上的 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>