Asp.Net网站对上传文件的大小,请求执行的时间都做了限制,上传的文件如果超过限制或者执行上传时间超出,

文件上传都将失败.

  因此,需要配置web.config来增加最大文件上传的大小和执行超时时间.

  1.配置httpRuntime节点(默认maxRequestLength为4M,executeTimeout为90秒):

<system.web>
    <httpRuntime targetFramework="4.5" maxRequestLength="1024000" executionTimeout="3600" />
</system.web>

配置后, maxRequestLength为1000M, executeTimeout为3600秒.

 

 2.配置requestLimits节点(默认maxAllowedContentLength为30M):

 <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="1048576000"></requestLimits>
      </requestFiltering>
    </security>
  </system.webServer>

配置后,maxAllowedContentLength为1000M.

 

说明: 建议将maxRequestLength和maxAllowedContentLength配置为一致大小, 若不一致,文件上传的大小限制将取两者之间的较小者.

 

相关文章:

  • 2021-09-19
  • 2021-08-10
  • 2021-06-08
  • 2021-11-26
  • 2021-11-20
  • 2021-11-20
  • 2021-11-11
  • 2021-06-18
猜你喜欢
  • 2021-11-20
  • 2021-11-17
  • 2021-11-20
  • 2021-12-07
  • 2021-05-12
  • 2021-11-20
  • 2021-11-20
相关资源
相似解决方案