我正在使用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>
答案 0 :(得分:0)
将maxBufferSize =“2147483647”参数添加到config中的客户端和服务器绑定标记:
<binding name="secureHttpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647">
尝试使用MaxItemsInObjectGraph - 将以下内容添加到服务器和客户端的“system.serviceModel”部分:
<commonBehaviors>
<endpointBehaviors>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</endpointBehaviors>
<serviceBehaviors>
<dataContractSerializer maxItemsInObjectGraph="2147483647" />
</serviceBehaviors>
</commonBehaviors>