C# WCF服务远程服务器返回意外响应:(413)请求实体太大
我有一个例外,比如 “远程服务器返回了意外响应:(413)请求 实体太大。” 将413KB的文件从MVC应用程序(客户端)上载到WCF服务时。有谁能帮我解决这个问题吗?我不知道出了什么问题 服务器堆栈跟踪: 在 在[0]处重试异常: 在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData,Int32类型) 在 客户端Web.configC# WCF服务远程服务器返回意外响应:(413)请求实体太大,c#,.net,asp.net-mvc,wcf,C#,.net,Asp.net Mvc,Wcf,我有一个例外,比如 “远程服务器返回了意外响应:(413)请求 实体太大。” 将413KB的文件从MVC应用程序(客户端)上载到WCF服务时。有谁能帮我解决这个问题吗?我不知道出了什么问题 服务器堆栈跟踪: 在 在[0]处重试异常: 在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)在 System.Runtime.Remoting.Proxies.Rea
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="true" logKnownPii="true" logMalformedMessages="true" logMessagesAtTransportLevel="true"/>
<endToEndTracing propagateActivity="true" activityTracing="true" messageFlowTracing="true"/>
</diagnostics>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IWebClientService" allowCookies="true" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"
closeTimeout="20:20:00" openTimeout="20:20:00" sendTimeout="20:20:00" receiveTimeout="20:20:00">
</binding>
<binding name="BasicHttpBinding_IReports" allowCookies="true" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"
closeTimeout="20:20:00" openTimeout="20:20:00" sendTimeout="20:20:00" receiveTimeout="20:20:00">
</binding>
<binding name="BasicHttpBinding_IHealthCheckService" allowCookies="true" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"
closeTimeout="20:20:00" openTimeout="20:20:00" sendTimeout="20:20:00" receiveTimeout="20:20:00">
</binding>
<binding name="BasicHttpBinding_IUserService" allowCookies="true" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647"
closeTimeout="20:20:00" openTimeout="20:20:00" sendTimeout="20:20:00" receiveTimeout="20:20:00">
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="endPointBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="http://localhost:5572/HealthCheckService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IHealthCheckService" contract="HCSSS.IHealthCheckService" name="BasicHttpBinding_IHealthCheckService"/>
<endpoint address="http://localhost:5572/Reports.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IReports" contract="ReportService.IReports" name="BasicHttpBinding_IReports"/>
<endpoint address="http://localhost:5572/UserService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUserService" contract="UserService.IUserService" name="BasicHttpBinding_IUserService"/>
<endpoint address="http://localhost:5572/WebClientService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWebClientService" contract="WebClientService.IWebClientService" name="BasicHttpBinding_IWebClientService"/>
</client>
</system.serviceModel>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483647"/>
</requestFiltering>
</security>
</system.webServer>
服务器Web.config
<system.serviceModel>
<diagnostics>
<messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
<endToEndTracing propagateActivity="true" activityTracing="true" messageFlowTracing="true" />
</diagnostics>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IWebClientService" allowCookies="true"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
closeTimeout="20:20:00" openTimeout="20:20:00" sendTimeout="20:20:00" receiveTimeout="20:20:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" />
</binding>
<binding name="BasicHttpBinding_IReports" allowCookies="true"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
closeTimeout="20:20:00" openTimeout="20:20:00" sendTimeout="20:20:00" receiveTimeout="20:20:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" />
</binding>
<binding name="BasicHttpBinding_IHealthCheckService" allowCookies="true"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
closeTimeout="20:20:00" openTimeout="20:20:00" sendTimeout="20:20:00" receiveTimeout="20:20:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" />
</binding>
<binding name="BasicHttpBinding_IUserService" allowCookies="true"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
closeTimeout="20:20:00" openTimeout="20:20:00" sendTimeout="20:20:00" receiveTimeout="20:20:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<!--To avoid disclosing metadata information, set the values below to false before deployment-->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpBinding" scheme="http" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<security>
<requestFiltering>
<!--<requestLimits maxAllowedContentLength="2147483647" />-->
<requestLimits maxAllowedContentLength="2147483647" />
</requestFiltering>
</security>
<modules runAllManagedModulesForAllRequests="true" />
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true" />
</system.webServer>
您的服务在哪里
标记?1)尝试将readerQuotas部分添加到客户端绑定中。2) 尝试将属性MaxBytesPerRead=2147483647添加到readerQuotas。您的服务标记在哪里?1)也尝试将readerQuotas部分添加到客户端绑定。2) 尝试将属性MaxBytesPerRead=2147483647添加到readerQuotas。
<system.serviceModel>
<diagnostics>
<messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
<endToEndTracing propagateActivity="true" activityTracing="true" messageFlowTracing="true" />
</diagnostics>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IWebClientService" allowCookies="true"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
closeTimeout="20:20:00" openTimeout="20:20:00" sendTimeout="20:20:00" receiveTimeout="20:20:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" />
</binding>
<binding name="BasicHttpBinding_IReports" allowCookies="true"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
closeTimeout="20:20:00" openTimeout="20:20:00" sendTimeout="20:20:00" receiveTimeout="20:20:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" />
</binding>
<binding name="BasicHttpBinding_IHealthCheckService" allowCookies="true"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
closeTimeout="20:20:00" openTimeout="20:20:00" sendTimeout="20:20:00" receiveTimeout="20:20:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" />
</binding>
<binding name="BasicHttpBinding_IUserService" allowCookies="true"
maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
closeTimeout="20:20:00" openTimeout="20:20:00" sendTimeout="20:20:00" receiveTimeout="20:20:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
<!--To avoid disclosing metadata information, set the values below to false before deployment-->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="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="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
</endpointBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpBinding" scheme="http" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<security>
<requestFiltering>
<!--<requestLimits maxAllowedContentLength="2147483647" />-->
<requestLimits maxAllowedContentLength="2147483647" />
</requestFiltering>
</security>
<modules runAllManagedModulesForAllRequests="true" />
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true" />
</system.webServer>