Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all
I am getting HTTP/1.1 413 Request Entity Too Large in the response header when i try to send base64 encoded string to a web method

The web method accepts JSON. This works fine for small images (encoded as base64 string) but i am wondering why its not working for large images for instance 250 KB

i tried to change maxJsonLength property
C#
<system.web.extensions>
    <scripting>
      <webServices><jsonSerialization maxJsonLength="33554432">....

to
C#
<jsonSerialization maxJsonLength="2147483647">...


but changing this value have no effect and still getting HTTP/1.1 413 Request Entity Too Large for large images

Any ideas why setting maxJsonLength is not working...
thanks
Posted
Comments
Ravi Bhavnani 3-Mar-15 14:49pm    
It may be a WCF issue. Try setting "maxReceivedMessageSize" to a larger value.

/ravi
Ravi Bhavnani 3-Mar-15 14:50pm    
See this SO link:

http://stackoverflow.com/questions/10122957/iis7-413-request-entity-too-large-uploadreadaheadsize

/ravi
[no name] 3-Mar-15 15:27pm    
thanks for the link it was not working for basicHttpBinding , but webHttpBinding in my case

1 solution

Actually i found it myself ,after some googling and an awesome link http://tech.avivo.si/2011/10/increase-maximum-request-length-for-wcf-rest-web-service-asp-net-4/[^]

XML
<bindings>
      <!-- Customizations for REST service -->
      <webHttpBinding>
        <!-- Limits set to 10 MB (specified value in bytes) -->
        <binding name="ApiQuotaBinding" maxReceivedMessageSize="10485760" 
maxBufferPoolSize="10485760" maxBufferSize="10485760" closeTimeout="00:03:00" 
openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:03:00">
          <readerQuotas maxDepth="32" maxStringContentLength="10485760" 
maxArrayLength="10485760" maxBytesPerRead="10485760" />
          <security mode="None" />
        </binding>
      </webHttpBinding>
    </bindings>


----in the endpoint section make a reference to binding ApiQuotaBinding
XML
 <!-- Added attribute 'bindingConfiguration' -->
        <endpoint address="" bindingConfiguration="ApiQuotaBinding" binding="webHttpBinding" 
contract="Avivo.Web.Services.IApiService" behaviorConfiguration="ApiBehavior" ></endpoint>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900