So while developing an ASP.NET MVC Web application you might face this error because of the maximum default length of a web request is exceeded in terms of customers. So I am going to tell you how you can fix it by simply modifying your web.config file:

If you are using IIS for hosting your application add this in your web.config to increase the size.

<configuration>

<system.web>

<httpRuntime maxRequestLength="1048576" />

</system.web>

</configuration>

If you are using IIS 7 or above add this code too.

<system.webServer>

<security>

<requestFiltering>

<requestLimits maxAllowedContentLength="1073741824" />

</requestFiltering>

</security>

</system.webServer>

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