使用托管在 windows azure 上的 asp.net 5.0 应用程序上传大文件 (>4MB)

Upload large file (>4MB) with asp.net 5.0 app hosted on windows azure

我想将一个大文件 (>4mb) 上传到我的 asp.net 5.0 应用程序,使用此配置在我的计算机上一切正常:

  <configuration>
    <system.webServer>
      <security>
        <requestFiltering>
          <requestLimits maxAllowedContentLength="2147483648" maxQueryString="2000">
          </requestLimits>
        </requestFiltering>
      </security>
      <handlers>
        <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
      </handlers>
      <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" forwardWindowsAuthToken="false" startupTimeLimit="3600"  />
    </system.webServer>
    <system.web>
      <httpRuntime maxRequestLength="102400000" />
    </system.web>
  </configuration>

但在 azure(Web 角色)上它只适用于 4MB 以下的文件。

我认为 IIS 没问题,是 Kestrel 或 webListner 不想处理请求(我得到 "The specified CGI application encountered an error and the server terminated the process."),我不知道是否也可以配置它。

听起来又是一个极限。 system.web 部分对 ASP.NET 5 个应用程序无效

来自这篇文章 (vNext maxRequestLength):

ASP.NET 5.0 中没有预定义配置:

  • 所有配置都在代码中完成
  • ASP.NET5.0中没有System.Web。
  • 您仍然可以使用 web.config 仅用于 IIS 设置
  • 即将支持 MaxRequestLength