Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum request length exceeded.

I am getting the error Maximum request length exceeded when I am trying to upload a video in my site.

How do I fix this?

like image 836
Surya sasidhar Avatar asked Oct 04 '10 08:10

Surya sasidhar


People also ask

What is Maximum request length exceeded?

Large file uploads in ASP.NET The default maximum filesize is 4MB - this is done to prevent denial of service attacks in which an attacker submitted one or more huge files which overwhelmed server resources. If a user uploads a file larger than 4MB, they'll get an error message: "Maximum request length exceeded."

What is Max request length?

Notes: default value for maxRequestLength is 4096 (4mb). max value is 2,147,483,647.

What is maxAllowedContentLength in web config?

The maxRequestLength indicates the maximum file upload size supported by ASP.NET, the maxAllowedContentLength specifies the maximum length of content in a request supported by IIS.


1 Answers

If you are using IIS for hosting your application, then the default upload file size is 4MB. To increase it, please use this below section in your web.config -

<configuration>     <system.web>         <httpRuntime maxRequestLength="1048576" />     </system.web> </configuration> 

For IIS7 and above, you also need to add the lines below:

 <system.webServer>    <security>       <requestFiltering>          <requestLimits maxAllowedContentLength="1073741824" />       </requestFiltering>    </security>  </system.webServer> 

Note:

  • maxRequestLength is measured in kilobytes
  • maxAllowedContentLength is measured in bytes

which is why the values differ in this config example. (Both are equivalent to 1 GB.)

like image 72
Sachin Shanbhag Avatar answered Dec 04 '22 08:12

Sachin Shanbhag