远程服务器返回错误:(413)在WCF中请求实体太大

问题描述 投票:0回答:1

WCF服务正在返回

远程服务器返回错误:(413)请求实体太大

但数据大小只有80KB我配置了2GB最大大小。我尝试了堆栈溢出,但我仍面临同样的问题。

组态:

<service name="HP.VFS.ShoppingcartService.ShoppingCart">
    <endpoint name="SOAPEndPoint" contract="HP.VFS.ShoppingcartService.IShoppingCart" binding="basicHttpBinding" address="soap" />
    <endpoint name="RESTEndPoint" contract="HP.VFS.ShoppingcartService.IShoppingCart" binding="webHttpBinding" address="api" behaviorConfiguration="restbehavior" /> <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>

<basicHttpBinding>
    <binding name="basicHttpBinding" closeTimeout="10:00:00" receiveTimeout="10:00:00" sendTimeout="10:00:00">
         <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
    <binding name="soap" closeTimeout="10:00:00" receiveTimeout="10:00:00" sendTimeout="10:00:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
        <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
    </binding>
</basicHttpBinding>

服务器端接口

[OperationContract(Name = "wstCreateOrder")]
[FaultContract(typeof(ApplicationFault))]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped,UriTemplate = "/wstCreateOrder/OrderInfo")]
string CreateOrder(string OrderInfo);

在客户端

Service.CreateOrder(80+ KB string);

我正在访问WCF服务,以便通过MVC4 .Net应用程序内的SOAP协议传输数据。参数all都是字符串类型。在调用该方法时,如果文本大小超过60 KB,则会抛出类似“远程服务器返回错误:(413)Request Entity Too Larg”的错误。但是在基于stackoverflow准则的服务器配置中,为Configuration中收到的Max消息添加MAX大小仍然面临同样的帮助。

wcf-binding http-status-code-413 transactiontoolargeexception
1个回答
0
投票

谢谢大家。最后我得到了解决方案。解决方案只是将maxDepth“2000000”的大小增加到“2147483647”问题解决了。

© www.soinside.com 2019 - 2024. All rights reserved.