C# wcf.net 4.6 iis 7.5 413错误
从asp.net应用程序/控制台应用程序调用wcf服务时遇到问题。我收到的错误是“远程服务器返回错误:(413)请求实体太大。” web.config和app.config都有以下行:C# wcf.net 4.6 iis 7.5 413错误,c#,asp.net,wcf,C#,Asp.net,Wcf,从asp.net应用程序/控制台应用程序调用wcf服务时遇到问题。我收到的错误是“远程服务器返回错误:(413)请求实体太大。” web.config和app.config都有以下行: <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IWCLService" maxBufferPoolSize="2147
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IWCLService" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
<readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://[server]/[projectname].wcfservice/WCLService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWCLService" contract="wclSvc.IWCLService" name="BasicHttpBinding_IWCLService" />
</client>
</system.serviceModel>
这是wcf服务本身的web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6" />
<httpRuntime maxRequestLength="104857600" targetFramework="4.6" />
<customErrors mode="Off" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<directoryBrowse enabled="true" />
<staticContent>
<mimeMap fileExtension=".svc" mimeType="application/octet-stream" />
</staticContent>
<handlers>
<add name="svc-integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler" resourceType="File" preCondition="integratedMode" />
</handlers>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="104857600" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
检查预读字节设置。查看类似问题的答案:
如果你发现某人的答案对你有帮助,一定要投票支持他/她的答案。在信用到期时给予信用。请提供更多信息,即至少提供您收到的具体错误(消息)。“我有问题”有点过于笼统,无法采取行动。您好,Christian,“远程服务器返回了一个错误:(413)请求实体太大。”您的请求有多大。尝试使用fiddler查看正在发送的消息。你好,J Man,这是我从fiddler获得的信息:请求计数:发送1个字节:147850(头:379;正文:147471)接收字节:200(头:200;正文:0)请共享wcf服务的web.config