System.Web.HttpException(0x80004005):上传文件时超出了最大请求长度

问题描述:

我知道可以通过在webconfig中增加maxRequestLength来解决它。但是我被限制这样做。



如果我上传大于5 MB的文件,我会收到此错误。





如果不改变web.config,请建议我任何替代方法。

I know it can be solved by increasing maxRequestLength in webconfig. but i am restricted to do so.

I am getting this error if i upload file greater then 5 MB.


Please suggest me any alternate way to do this without altering web.config.

在Machine.config中设置了默认的4MB最大请求长度,唯一可以覆盖它的方法是设置system.web - >适用于您的应用程序的web.config中的httpRuntime。



在IIS 7中尝试类似下面的内容



appcmd set config我的网站/ MyApp-section:requestFiltering -requestLimits.maxAllowedContentLength:104857600 -commitpath:apphost



来源 - http://weblogs.asp.net/jgalloway/archive/2008/01/08/large -file-uploads-in-asp-net.aspx [ ^ ]
There's a default of 4MB max request length set in Machine.config , The only way you can override this is set the system.web -> httpRuntime in web.config for your application.

Try something like below in IIS 7

appcmd set config "My Site/MyApp" -section:requestFiltering -requestLimits.maxAllowedContentLength:104857600 -commitpath:apphost

Source - http://weblogs.asp.net/jgalloway/archive/2008/01/08/large-file-uploads-in-asp-net.aspx[^]