文件上传大小限制、超时时间配置

1.在<system.web>节点内配置

<httpRuntime executionTimeout="3600" maxRequestLength="1048576" requestValidationMode="2.0"/>

属性说明:

executionTimeout:超时时间,单位:秒

maxRequestLength:允许上传文件大小,单位:KB。默认上传的文件大小为4M,超出报错。

requestValidationMode="2.0":必要,否则报错:Internal Server Error

2.在<system.webServer>节点内配置

    <security>  
      <requestFiltering allowDoubleEscaping="true">            
          <requestLimits maxAllowedContentLength="1073741824"></requestLimits>  
      </requestFiltering>  
    </security>

属性说明:

maxAllowedContentLength:允许上传文件大小,单位:B。默认上传的文件大小为30M,超出报错。最多支持4GB(4294967295)

猜你喜欢

转载自www.cnblogs.com/zhangwj/p/9829844.html