IIS7上传文件大小設定

本文介绍如何通过修改Web.Config文件中的maxRequestLength和maxAllowedContentLength参数来设置IIS中文件上传的最大尺寸,包括单个站点配置及全局配置方法。

1、首先、修改Web.Config中的maxRequestLength、单位是KB;executionTimeout单位是秒。例:maxRequestLength=1024(1MB)executionTimeout=3600(60分)  <system.web>
    <httpRuntime maxRequestLength="2097151" executionTimeout="3600"/>
  </system.web>
2、上面设定好后、Web.Config的maxAllowedContentLength也必须要设定。单位:Byte、下面的例子设定大小为:1G。
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="1024000000"></requestLimits>
      </requestFiltering>
    </security>
  </system.webServer>
注意:要使2的設定生效,要确保C:\Windows\System32\inetsrv\config\applicationhost.config中的下面的节点为“Allow”。
modify the overrideModeDefault from "Deny" to "Allow" like so:
<sectionGroup name="system.webServer">
     <section name="requestFiltering" overrideModeDefault="Allow" />
</sectionGroup>

3、上面2的设定只针对一个Web站点,需设定所有IIS的站点的话,可以修改C:\Windows\System32\inetsrv\config\applicationhost.config的maxAllowedContentLength节点。
设定的方法和2是一样的。

注意:上面的1,2就能够完成文件大小的限制设定了,一般不会去设定3的步骤。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值