in ASP.NET, IIS, Windows

Changing file upload limits in ASP.NET on IIS 7 or greater

When uploading files greater than 28.6 MB (30000000 Bytes) with ASP.NET on IIS 7.5 using SWFUpload I’m getting this error:

There has been an I/O Error: Error #2038

The reason is that IIS 7 and greater has a request limit of 28.6 MB. The limit can be raised to 100 MB using the following commands:

cd C:\Windows\System32\inetsrv
appcmd set config -section:requestFiltering -requestLimits.maxAllowedContentLength:104857600

You can also do this in the IIS Manager:

  1. Open the IIS Manager
  2. From the server home tree item, open the Request Filtering item
  3. Click Edit Feature Settings… on the right
  4. Set the Maximum allowed content length (Bytes)