ASP.NET Error - Maximum request length exceeded - Solved

← Prev

The error Maximum request length exceeded in ASP.NET means the HTTP request (usually a file upload) is larger than the maximum size allowed by the application.

rror - Maximum request length exceeded - Solved

Solution for ASP.NET (.NET Framework)

In your web.config, increase the maxRequestLength value under <httpRuntime>. Open web.config file in your project and find maxRequestLength or httpRuntime tag.

<configuration>
  <system.web>
    <httpRuntime maxRequestLength="10240" executionTimeout="3600" />
  </system.web>
</configuration>

If you're using IIS 7+, then you also need to increase the IIS request limit.

XML:

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

Solution for ASP.NET Core

In ASP.NET Code, the configuration is different. For example, in Program.cs,

builder.Services.Configure<IISServerOptions>(options =>
{
    options.MaxRequestBodySize = 104857600; // 100 MB
});

If you are still getting the error, then check...

← Previous