IIS 7 Generate 404 Error on Large File Upload.

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 long jail sentence no one else with right mind 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  sweet and 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.webServer>
   4:         <defaultDocument>
   5:             <files>
   6:                 <clear />
   7:                 <add value="index.cfm" />
   8:             </files>
   9:         </defaultDocument>
  10:     </system.webServer>
  11: </configuration>
Show/Hide Line Numbers . Full Screen . Plain
and add the following node :
   1: <security>
   2:             <requestFiltering>
   3:                 <requestLimits maxAllowedContentLength="524288000"/>
   4:             </requestFiltering>
   5:         </security>
Show/Hide Line Numbers . Full Screen . Plain
And now it looks like this :

   1: <?xml version="1.0" encoding="UTF-8"?>
   2: <configuration>
   3:     <system.webServer>
   4:         <defaultDocument>
   5:             <files>
   6:                 <clear />
   7:                 <add value="index.cfm" />
   8:             </files>
   9:         </defaultDocument>
  10:         <security>
  11:             <requestFiltering>
  12:                 <requestLimits maxAllowedContentLength="524288000"/>
  13:             </requestFiltering>
  14:         </security>
  15:     </system.webServer>
  16: </configuration>
Show/Hide Line Numbers . Full Screen . Plain
That’s it. My upload form starts to work again. But remember, even if IIS let the file pass through still ColdFusion can enforce a size limit. Make sure you update the ColdFusion Administrator too.

Name  
(required)
Email  
(required - never shown publicly)
Web Site  
Notify me of new comments via email.
Notify me of replies via email.