远程服务器返回意外响应(413)请求实体太大。 WCF [英] the remote server returned an unexpected response (413) request entity too large. wcf
本文介绍了远程服务器返回意外响应(413)请求实体太大。 WCF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
My server Config
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="PosConnectionString" connectionString="Data Source=.;Initial catalog=Master;Uid=sa;Pwd=123"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime maxRequestLength="2147483647" />
</system.web>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true">
<listeners>
<add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\logs\Traces.svclog"/>
</listeners>
</source>
</sources>
</system.diagnostics>
<system.serviceModel>
<services>
<service name="PosServiceRef.PosService1">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:1267/PosService1.svc" />
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="basicHttpBinding_IPosService1" contract="PosServiceRef.IPosService1"
name="BasicHttpBinding_IPosService1" >
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<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="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding_IPosService1" closeTimeout="00:20:00"
openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="None"/>
</binding>
<!--<binding>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
</binding>-->
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
我的客户端配置
My Client Config
<system.serviceModel>
<services>
</services>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IPosService11" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:1267/PosService1.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IPosService11"
contract="PosServiceRef.IPosService1" name="BasicHttpBinding_IPosService1" />
</client>
</system.serviceModel>
推荐答案
I ran into this problem recently and tried many variations of config settings to get it to work. I came across a solution buried in the depths of some MSDN article after much searchng that suggested removing the binding name which worked.
I ran into this problem recently and tried many variations of config settings to get it to work. I came across a solution buried in the depths of some MSDN article after much searchng that suggested removing the binding name which worked.
<binding name="basicHttpBinding_IPosService1"></binding>
In the snippet above remove the binding name.
In the snippet above remove the binding name.
这篇关于远程服务器返回意外响应(413)请求实体太大。 WCF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文