.NET上传大文件时提示Maximum request length exceeded错误的解决方法

使用IIS托管应用程序时,当我们需要上传大文件(4MB以上)时,应用程序会提示Maximum request length exceeded的错误信息。该错误信息的翻译:超过最大请求长度。
解决方法:
使用IIS来托管应用程序,默认的上传文件大小为4MB。我们需要增加请求大小,在项目的Web.config配置文件中添加以下配置项信息:
<configuration>   
  <system.web>       
    <httpRuntime maxRequestLength="1048576" />  
    </system.web>
</configuration>
对于IIS7及以上版本,还需要添加以下配置项信息:
<system.webServer>  
  <security>     
    <requestFiltering>        
      <requestLimits maxAllowedContentLength="1073741824" />
    </requestFiltering>  
  </security>
</system.webServer>
注意:
maxRequestLength以千字节(KB)度量。
maxAllowedContentLength以字节(bytes)度量。
所以上述实例中,我们将请求大小增加到了1GB。
原文地址:https://www.cnblogs.com/accumulater/p/10688854.html