HTTP上传大文件的注意点

使用HttpWebRequest上传大文件时,服务端配置中需要进行以下节点配置:

<system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime maxRequestLength="100000000" executionTimeout="600"></httpRuntime>
</system.web>
<system.webServer>
    <security>
      <requestFiltering>
        <!--这个节点直接决定了客户端文件上传最大值-->
        <requestLimits maxAllowedContentLength="2147483647" />
      </requestFiltering>
    </security>
  </system.webServer>

否则会出现服务端返回404错误。

原文地址:https://www.cnblogs.com/xiaotiannet/p/4906701.html