Tuesday, June 14, 2011

404 Errors with FileUpload in ASP.NET MVC

Many props to Phil Scott over at weblogs.asp.net. His post entitled "404 Errors with FileUpload with IIS7" just saved me many hours of headache. While the issue was exactly the same, I've entitled this post a little differently as for me it was not immediately apparent that IIS was the culprit.

The meat of the issue was 404 errors received while trying to upload a file. This worked perfectly in the development environment (my laptop), but failed almost all the time on the server.

The real culprit was IIS7 and the web.config. Here is the page on the IIS website concerning the system.Webserver/requestLimits section.

Here is the section that ultimately fixed my issue:

<system.webServer>

<security>

      <requestFiltering>

        <requestLimits maxAllowedContentLength="262144000" />

      </requestFiltering>

    </security>

  </system.webServer>

Enjoy!

1 comment:

  1. Thanks a lot pal! This issue was really driving me nuts. IIS configuration really sucks.

    ReplyDelete