远程服务器返回错误:(413)请求实体太大
我知道这是一个多余的问题,我在上传大于100 KB的文件时出现错误。远程服务器返回错误:(413)请求实体太大
The remote server returned an error: (413) Request Entity Too Large.
我将内容发布到WCF服务(64位环境)。我知道这应该已经通过管理maxReceivedMessageSize和相关行为来解决,但不幸的是它没有。
下面是我的配置: -
客户
<binding allowCookies="false" bypassProxyOnLocal="false" closeTimeout="00:01:00" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" name="BasicHttpBinding_ICandidateManagementService" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:11:00" textEncoding="utf-8" transferMode="Streamed" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message algorithmSuite="Default" clientCredentialType="UserName"/>
</security>
</binding>
<behavior name="CandidateBehavior">
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</behavior>
<endpoint address="http://localhost:62368/CandidateManagementService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICandidateManagementService" contract="MMJ.ServiceContracts.ServiceContract.ICandidateManagementService" name="BasicHttpBinding_ICandidateManagementService" behaviorConfiguration="CandidateBehavior" />
服务
<services>
<service name="BasicHttpBinding_ICandidateManagementService" behaviorConfiguration="CandidateBehavior">
<endpoint contract="MMJ.ServiceContracts.ServiceContract.ICandidateManagementService" binding="basicHttpBinding" address="" bindingConfiguration="BasicHttpBinding_ICandidateManagementService"/>
</service>
我所看到的一切可能提供与斜面仍然解决这个问题。也尝试过使用下面的配置,但仍然没有变化...
<serverRuntime uploadReadAheadSize="500000000" maxRequestEntityAllowed="500000000"/>
请帮忙!
服务绑定配置(其作为客户端相同)
<binding allowCookies="false" bypassProxyOnLocal="false" closeTimeout="00:01:00" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" name="BasicHttpBinding_ICandidateManagementService" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:11:00" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="32" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message algorithmSuite="Default" clientCredentialType="UserName"/>
</security>
</binding>
为了让下面更深入的了解是小提琴手发现: -
Request Count: 1 Bytes Sent: 85,719 (headers:697; body:85,022) Bytes Received: 10,129 (headers:254; body:9,875)
最后我的问题所困扰了很多之后得到解决。 我的服务配置有一个缺陷,它没有给我任何运行时或编译时错误,因为它甚至没有识别配置。
我的服务配置为: -
<services>
<service name="BasicHttpBinding_ICandidateManagementService" behaviorConfiguration="CandidateBehavior">
<endpoint contract="MMJ.ServiceContracts.ServiceContract.ICandidateManagementService" binding="basicHttpBinding" address="" bindingConfiguration="BasicHttpBinding_ICandidateManagementService"/>
</service>
我有“名称”属性,它不是我服务的全名,因此我所用甚至没有考虑,因此正在采取默认的65KB配置为maxReceivedMessageSize。
我已更新它,它的工作就像一个魅力。
<services>
<service name="MMJ.Services.CandidateManagementService">
<endpoint contract="MMJ.ServiceContracts.ServiceContract.ICandidateManagementService" binding="basicHttpBinding" address="" bindingConfiguration="BasicHttpBinding_ICandidateManagementService"/>
</service>
另外,看看这个post为更多的参考。我知道这是一个愚蠢的错误,并且感谢大家努力修复。
您的问题对我有帮助。我有同样的问题,但只是使用'maxReceivedMessageSize =“2000000”'解决。 – 2014-01-20 13:04:38
看你的客户端点:
不应该bindingConfiguration是
bindingConfiguration="BasicHttpBinding_ICandidateManagementService"
而不是
bindingConfiguration="BasicHttpBinding_IAdminService"
我以为你还需要在IIS中设置一些东西,但不知道肯定。 – 2013-03-11 13:40:56
我不这么认为,如果你遇到任何问题,请告诉我。 – Wali 2013-03-11 16:14:45
我在Chrome上检索到相同的错误。当我切换到Firefox时,所有问题都消失了。 – 2016-12-16 19:13:00