【发布时间】:2016-06-10 04:49:47
【问题描述】:
我正在开发一个使用 wsHTTPBinding 的 WCF 服务,当我在某个时刻使用我的客户端测试应用程序进行调用时,我收到错误远程服务器返回了意外响应:The remote server returned an error: (413) Request Entity Too Large.
我的 web.config 中服务的绑定配置如下:
<wsHttpBinding>
<binding name="secureHttpBinding" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"/>
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
以及服务端的端点:
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="secureHttpBinding" contract="WS_UCC_XML.IWS_UCC_XML" />
以及客户端中的绑定配置:
<wsHttpBinding>
<binding name="wsHttpBinding_IWS_UCC_XML_SSL" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647" receiveTimeout="01:00:00" sendTimeout="01:00:00">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxNameTableCharCount="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647" />
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</wsHttpBinding>
【问题讨论】:
-
1) 这可能是服务端的设置,而不是客户端的设置。 2)您的服务配置中是否定义了明确的端点?除非将其分配给端点,否则不会使用配置中的绑定定义。请发布您的服务配置的完整
<system.serviceModel>部分。 -
我在问题中添加了端点配置。
-
尝试为 system.webServer->security->reqestFiltering 中
<requestLimits>元素的maxAllowedContentLength属性设置上限。定义的绑定看起来是正确的。