Search code examples
wcf-bindinghttp-status-code-413transactiontoolargeexception

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


WCF Service is returning

The remote server returned an error: (413) Request Entity Too Larg

but data size only 80KB i configured 2GB max size. I tried in stack overflow but still I am facing the same issue.

Configuration:

<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>

Server Side Interface

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

In client side

Service.CreateOrder(80+ KB string);

I am accessing WCF service for transferring data via SOAP protocol inside MVC4 .Net application. Parameter all are string type. While calling the method if the text size is more than 60 KB it's throwing an error like "The remote server returned an error: (413) Request Entity Too Larg". But in Server configuration based on stackoverflow guidelines i added MAX size for Max message received in Configuration still am facing the same kindly help me.


Solution

  • Thanks for all. finally i got the solution. solution is just increasing the size for maxDepth "2000000" to "2147483647" problem solved.