IIS文件上传大小修改配置说明

时间:2023-03-09 02:03:29
IIS文件上传大小修改配置说明

原因:Web 服务器上的请求筛选被配置为拒绝该请求,因为内容长度超过配置的值(IIS 7 默认文件上传大小时30M)。

解决:IIS7更改asp.net文件上传大小限制

步骤如下:

    1. 1.    修改IIS7applicationhost.config配置

    位置: C:\Windows\System32\inetsrv\config\applicationhost.config

    找到<requestFiltering>节点,该节点下默认没有 <requestLimits maxAllowedContentLength="上传大小的值(单位:byte)" /> 元素。为这个节点添加如下元素:<requestLimits maxAllowedContentLength="209715200" />  (上传的大小将改为200M)

    算法:200*1024*1024 = 209715200

    <requestLimits maxAllowedContentLength="209715200" ></requestLimits>
                </requestFiltering>

    </security>

    如果是IIS6,还需要修改c:\windows\system32\inetsrv下的metabase.xml文件

    调整AspMaxRequestEntityAllowed属性为相同的值.

    调整前要先停止站点

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

    找到maxRequestLength节点,修改其值,如没有,添加如下内容

    <configuration>
     
    <system.web>
        
    <httpRuntime
    maxRequestLength="204799"
    executionTimeout="120"/>
     
    </system.web>
    </configuration>

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

    <system.webServer>

    <security>

    <requestFiltering>

    <requestLimits
    maxAllowedContentLength="209715200" />

    </requestFiltering>

    </security>

    </system.webServer>

    4、修改web.configUpFileLength大小为204800

    <add key="UpFileLength" value="204800"/>

    附件

    http://files.cnblogs.com/files/KingUp/IIS%E4%B8%8A%E4%BC%A0%E9%99%84%E4%BB%B6%E5%A4%A7%E5%B0%8F%E9%99%90%E5%88%B6%E4%BF%AE%E6%94%B9.rar