雁过请留痕...
代码改变世界

IIS7上传文件大小設定

2013-09-29 15:24  xiashengwang  阅读(465)  评论(0编辑  收藏  举报

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的步骤。