IIS请求筛选模块被配置为拒绝超过请求内容长度的请求

HTTP错误404.13 - Not Found 请求筛选模块被配置为拒绝超过请求内容长度的请求,原因是Web服务器上的请求筛选被配置为拒绝该请求,因为内容长度超过配置的值(IIS 7 默认文件上传大小时30M)。

解决方法

1. 修改IIS的applicationhost.config

     a.文件位置: %windir%/system32/inetsrv/config/applicationhost.config

     b.找到 <requestFiltering> 节点

     c.为这个节点添加如下元素:<requestLimits maxAllowedContentLength="2147483647" /> (上传的大小将改为2G)

       注:该节点下默认没有 <requestLimits maxAllowedContentLength="上传大小的值(单位:byte)" /> 元素。

2. web.config中添加如下内容

1 <configuration>
2   <system.web>
3      <httpRuntime maxRequestLength="2097151" executionTimeout="120"/>
4   </system.web>
5 </configuration>

说明:
httpRuntime 配置 ASP.NET HTTP 运行时设置,以确定如何处理对 ASP.NET 应用程序的请求。
maxRequestLength (指示 ASP.NET 支持的最大文件上载大小)
指定输入流缓冲阈值限制(以 KB 为单位)。此限制可用于防止拒绝服务攻击;例如,因用户向服务器发送大型文件而导致的拒绝服务攻击。
默认值为 4096 (4 MB),最大值只能是2097151K。
executionTimeout:指定在被 ASP.NET 自动关闭前,允许执行请求的最大秒数。默认90秒。
只有当 compilation 元素中的调试属性为 False 时,此超时属性才适用。若要帮助避免在调试期间关闭应用程序,请不要将此超时属性设置为较大值。

3. web.config中,把以下内容加在<system.webServer>节点


1 <security>
2   <requestFiltering >
3      <requestLimits maxAllowedContentLength="2147483647" ></requestLimits>
4   </requestFiltering>
5 </security>

上述中maxAllowedContentLengt是以BK为单位。

 

 

<configuration>
<system.web>
<!--maxRequestLength 此值为上传文件的有效大小,单位为KB,默认为4M,最大值只能是2097151K-->
<!--executionTimeout 此值为上传文件的有效时间,单位为秒-->
<httpRuntime maxRequestLength="1024000" executionTimeout="600" targetFramework="4.5"/>
<compilation debug="true" targetFramework="4.5" />
</system.web>
<system.webServer>
<security>
<requestFiltering >
<requestLimits maxAllowedContentLength="2147483647" ></requestLimits>
</requestFiltering>
</security>
</system.webServer>
</configuration>

posted @ 2014-10-28 14:44  diablo大王  阅读(2948)  评论(0编辑  收藏  举报