将文件上传到 IIS 8 时超出最大请求长度

Maximum request length exceeded when uploading file to IIS 8

我得到:异常详细信息:System.Web.HttpException:超过最大请求长度。我正在使用 Windows 2012 IIS。我检查了 IIS 中的设置,它设置为 30000000。我上传的文件是 20mb。我尝试将下面的代码添加到 web.config 文件中。我上传了较小的文件,没有任何问题。还有其他想法吗?

<system.webServer>

   <security>

      <requestFiltering>

         <requestLimits maxAllowedContentLength="3000000000" />

      </requestFiltering>

   </security>

</system.webServer>

尝试像这样设置 maxRequestLength:

<configuration>
  <system.web>
    <httpRuntime maxRequestLength="500000" />
  </system.web>
</configuration>

maxRequestLength 表示 ASP.NET 支持的最大文件上传大小。指定的大小以千字节为单位。默认值为 4096 KB (4 MB)。

<httpRuntime maxRequestLength="43000000" targetFramework="4.5.2"/>

40 mb

所有代码system.web

 <system.web>
    <customErrors mode="Off" >
    </customErrors>
    <compilation debug="true" targetFramework="4.5.2"/>
    <httpRuntime maxRequestLength="43000000" targetFramework="4.5.2"/>
  </system.web>