IIS 7 Generate 404 Error on Large File Upload. (Maximum request length exceeded)

I was trying to upload/post a large file and received a flat and boring 404 error from IIS 7. Microsoft Site advices to update the applicationhost.config file in %windir%\system32\inetsrv\config\applicationhost.config and increase the BYTE value of maxAllowedContentLength in the <requestLimits>, so the IIS request filter may allow large post data to come through.

But my applicationhost.config file didn’t have <requestLimits> nod and except prisoners with a long jail sentence no one else in their right mind would learn configuration values by heart. But the command 

   1: %windir%\system32\inetsrv\appcmd set config -section:requestFiltering -requestLimits.maxAllowedContentLength:524288000
solve that issue. Add the <requestLimits> nod to my applicationhost.config with 500MB limit. Sweet!

I restart the IIS. Upload the file again. Well. Nothing Changed. @#$! I don’t know why. If you know, please let me know. That would be very kind. If you don’t, that’s ok. I’m not dying to know anyway.

The other option was update the web.config file, in the root of my web folder. My file looks something like this:

   1: <?xml version="1.0" encoding="UTF-8"?>
   2: <configuration>
   3:  <system.web>
   4:  <httpRuntime maxRequestLength="1048576" />
   5:  </system.web>
   6:  <system.webServer>
   7:  <security>
   8:  <requestFiltering>
   9:  <requestLimits maxAllowedContentLength="1073741824" />
  10:  </requestFiltering>
  11:  </security>
  12:  </system.webServer>
  13: </configuration>
Show/Hide Line Numbers . Full Screen . Plain

That’s it. My upload form starts to work again. But remember, even if IIS lets the file pass through, ColdFusion can still enforce a size limit. Make sure you update the ColdFusion Administrator too.

Update

You can also do this saftly by going into IIS (7.5) Admin, Request filtering (You have to have request filtering installed)

2 Comments :
samunder
Monday 28 April 2014 05:11 AM
Try this also. http://blogershub.com/Archive/2014/4/Upload-large-file-on-IIS-HTTP-ERROR-404-CONTENT-LENGTH-TOO-LARGE-HRESULT
Raje
Thursday 18 July 2013 07:43 AM
I have been struggling with this problem for last 1 day, and this solution worked for me.Thank u so much.