IIS 6”;超过了最大请求长度";Global.asax之前的触发器
本文关键字:Global quot asax 触发器 过了 请求 IIS | 更新日期: 2023-09-27 17:52:52
可能重复:
超过的最大请求长度
我正在使用IIS 6来托管我的Asp.net网站。我有
"超过了最大请求长度。">
错误。我在IIS 7上修复了它,但在IIS 6上,Asp.net错误在进入Global.asax
Application_error之前触发。我只是重定向到Application_Error
中的自定义错误页面。请让我知道我在这里缺了什么。
这是我在IIS 7 webconfig中使用的修复程序
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="100000" />
</requestFiltering>
</security>
<httpErrors errorMode="Custom" existingResponse="Replace">
<error statusCode="404" subStatusCode="13" prefixLanguageFilePath="" path="UploadError.aspx" responseMode="Redirect" />
</httpErrors>
上面的解决方案在IIS 6上不起作用!我需要在Global.asax
上的Application_Error
中执行此操作。在Maximum request length exceeded.
之前未触发
这是以下内容的副本:超过的最大请求长度
该线程包含IIS6和IIS7处理最大请求长度异常的解决方案
要重定向到自定义错误页面,请在Web.Config中使用以下命令:
<configuration>
...
<system.web>
<customErrors mode="RemoteOnly"
defaultRedirect="~/ErrorPages/Oops.aspx" />
...
</system.web>
</configuration>
其中"~/ErrorPages/Oops.aspx"是错误页面的路径。
除了security
块,您还需要更改具有maxRequestLength
属性的system.web'httpRuntime
。
<httpRuntime maxRequestLength="8192" />
有关msdn 的更多信息