簡體   English   中英

遠程服務器返回錯誤:(413)WCF中的請求實體太大

[英]The remote server returned an error: (413) Request Entity Too Large in WCF

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協議傳輸數據。 參數都是字符串類型。 在調用該方法時,如果文本大小超過60 KB,則會拋出類似“遠程服務器返回錯誤:(413)請求實體過大”之類的錯誤。 但是在基於stackoverflow准則的服務器配置中,我為Configuration中收到的Max消息添加了MAX大小,仍然面臨着同樣的幫助。

謝謝大家 終於我找到了解決方案。 解決方案只是將maxDepth的大小“ 2000000”增加到“ 2147483647”已解決問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM