Answered by:
Changing maxAllowedContentLength

Question
-
User1745037820 posted
I'm using VS.NET 2005 running on Vista.
The issue pertains to being able to upload large files in an ASP.NET application when using IIS 7.0 (and not when using the development webserver).
My Web.config file for my application I have:
maxRequestLength
="2097151" (the maximum allowed).However when uploading large files (I've tried with a 60MB file) I get this error from IIS 7.0:
_________________________________________________________________________________________
HTTP Error 404.13 - Not Found
Description: The request filtering module is configured to deny a request that exceeds the request content length.
Error Code: 0x00000000
Notification: BeginRequest
Module: RequestFilteringModule
What you can try:
- Verify the configuration/system.webServer/security/requestFiltering/requestLimits@maxAllowedContentLength setting in the applicationhost.config or web.config file.
More Information...
This is a security feature. Do not change this feature unless the scope of the change is fully understood. You can configure the IIS 7.0 server to reject requests whose content length is greater than a specified value. If the request's content length is greater than the configured length, this error is returned. If the content length requires an increase, modify the configuration/system.webServer/security/requestFiltering/requestLimits@maxAllowedContentLength setting._________________________________________________________________________________________
I've never changed any setting in IIS 7.0 and so would appreciate it if someone can tell me how to change this setting.
But more importantly, it seems that with IIS 7.0 we're now going to have to synchronize such settings in two places? Is that correct?
Thanks in advance for any help.
Shiv
Monday, January 22, 2007 5:22 PM
Answers
-
User1356161706 posted
Try this:
%windir%\system32\inetsrv\appcmd set config -section:requestFiltering -requestLim
its.maxAllowedContentLength:1000000or if you only want to set it for your app:
%windir%\system32\inetsrv\appcmd set config "Default Web Site/<your app>" -section:requestFiltering -requestLimits.maxAllowedContentLength:1000000
Hope this helps
- Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
Monday, January 22, 2007 5:38 PM -
User1745037820 posted
Ok, I see that appCmd.exe modifies the applications web.config file with the required entries. Great, this is what I was looking for.
Thank you for your help.
Shiv.
- Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
Monday, January 22, 2007 6:13 PM
All replies
-
User1356161706 posted
Try this:
%windir%\system32\inetsrv\appcmd set config -section:requestFiltering -requestLim
its.maxAllowedContentLength:1000000or if you only want to set it for your app:
%windir%\system32\inetsrv\appcmd set config "Default Web Site/<your app>" -section:requestFiltering -requestLimits.maxAllowedContentLength:1000000
Hope this helps
- Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
Monday, January 22, 2007 5:38 PM -
User1745037820 posted
Thomas,
Thank you for your quick reply! I'll try your suggestion...
Is there a GUI that I can use to set this or config file local to my application that I can create in order to set this?
Shiv.
Monday, January 22, 2007 5:49 PM -
User1745037820 posted
Thomas,
I tried your suggestion and eventually got it working but have another question.
What is the "unit of measure" for the maxAllowedContentLength attribute? In ASP.NET Web.config
maxRequestLength is in KB. It looks like the maxAllowedContentLength is in bytes?
Now in order to get your suggestion to work I had to modify the overrideModeDefault from "Deny" to "Allow" like so:
<
section name="requestFiltering" overrideModeDefault="Allow" />I'm assuming this change allows for "application level" control? If so, can I not add my setting to the web.config file of the application in question?
I had to "Allow
Monday, January 22, 2007 6:07 PM -
User1745037820 posted
Ok, I see that appCmd.exe modifies the applications web.config file with the required entries. Great, this is what I was looking for.
Thank you for your help.
Shiv.
- Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
Monday, January 22, 2007 6:13 PM -
User280150291 posted
Also,
With respect to this limit can anyone imagine a way to change the error returned from IIS from the very vague "HTTP Error 404.13 - Not Found" to something more relevant to the actual upload size error that actually occurs?
Monday, August 18, 2008 1:08 PM -
User1073881637 posted
Funny I just ran across this post and agree making the error more descriptive would help troubleshooting.
Thursday, April 2, 2009 8:08 AM -
User1383393805 posted
I'm trying to load an app on a site for a server I just converted over from Windows 2003 to Windows 2008, I have tried changing this but I keep getting the same error.
http://www.element-it.com/RequestFilteringModule-maxAllowedContentLength.aspx
"The request filtering module is configured to deny a request that exceeds the request content length"
The documentation from Microsoft says to change Applicationhost.config file but the file on my server doesn't even have the record which would make it work. The Web.Config file is set correctly there is nothing to change but it still will not let me upload more then 30 megs.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;295626
Any thoughts?
Monday, October 19, 2009 2:54 PM -
User604515596 posted
The below link may help you..
http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits
Wednesday, February 17, 2010 4:06 PM -
User-559433033 posted
Parabéns, funcionou 100%!!!
Best Regards,
Camanducci
Wednesday, August 18, 2010 4:41 PM -
User-612646714 posted
if your using IIS 7.0 try to change the request content length. put the following configuration in system.webServer section -security- -requestFiltering- -requestLimits maxAllowedContentLength="102400000"/- -/requestFiltering- -/security- , Sorry i had to use - instead of open and close tagThursday, January 13, 2011 12:34 PM -
User2020323310 posted
The solution of increasing setting maxAllowedContentLength is working for me. Can anyone explain the difference between requestFilter's maxAllowedContentLength and httpRuntime's maxRequestLength attributes of Web.Config?Wednesday, October 19, 2011 5:51 AM -
User1308987916 posted
I have a similar problem, im trying to run this comand but get the error
Error < hresult:80070003, message failed to commit configuration changes. the system cannot find the path specified. >
any clues whyThursday, November 3, 2011 12:16 PM