413 Error-Request Entity Too Large
when uploading more than 50KB file size then getting The remote server returned an unexpected response: (413) Request Entity Too Large.
Scenario is:
Created WCF service and hosted on IIS and same service called from web application. The WCF service is used for uploading files to web server.
For files which are having size below 50 KB it is working fine. but when we try with more than 50 KB size file then it fails.
Below are the possible areas to fix this
Scenario is:
Ensure IIS Request filtering configured with maximum allowed content length or not
To do this, open IIS Manager. Select relevant web site application.
In the right side panel Features view you will see “Request Filtering”.
Open this feature and on the right hand panel you will find “Edit Feature Settings”
Maximum Allowed Content Length is an Optional U-Int attribute.
It specifies the maximum length of content in a request, in bytes. The default value is
30000000
, which is approximately 28.6MB
Ensure “UploadReadAheadSize” in IIS specified with max size.
In the IIS – “UploadReadAheadSize” that prevents upload and download of data greater than 49KB. The value present by default is 49152 bytes and can be increased up to 4 GB.
The UploadReadAheadSize property establishes the number of bytes a Web server will read into a buffer and pass to an ISAPI extension. This occurs once per a client request. The range is from 0 to &HFFFFFFFF (4 GB)
To navigate to this setting, use the following steps:
- Launch "Internet Information Services (IIS) Manager"
- Expand the Server field
- Expand Sites
- Select the site your application is in.
- In the Features section, double click "Configuration Editor"
- Under "Section" select: system.webServer>serverRuntime
in this context, customer had maximum file size less than 50 MB, so configured it to 52428800 i.e. 50 MB.
Please note that the value is in Bytes.
I hope these setting helps and resolves the 413 error.
Comments
Post a Comment