IIS7上传文件大小設定

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:WindowsSystem32inetsrvconfigapplicationhost.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:WindowsSystem32inetsrvconfigapplicationhost.config的maxAllowedContentLength节点。
设定的方法和2是一样的。

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

原文地址:https://www.cnblogs.com/xiashengwang/p/3335309.html