c# - 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制?

标签 c# asp.net iis iis-7

我在这里将 maxRequestLength 设置为 2GB(最大值),这表示 ASP.NET 支持的最大请求大小:

<system.web>
    <httpRuntime maxRequestLength="2097151" executionTimeout="3600"/>
    ...

这里我将 maxAllowedContentLength 设置为 4GB(最大值),它指定了 IIS 支持的请求中内容的最大长度

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

我希望能够上传最大 4GB 的文件,但我受到 maxRequestLength 字段的限制。

我注意到这个第三方上传工具 (http://www.element-it.com/onlinehelp/webconfig.html) 有一个 ignoreHttpRuntimeMaxRequestLength 属性,允许它上传文件最多4GB。

有谁知道我是否可以像其他上传工具那样忽略 maxRequestLength 值?

最佳答案

考虑 MaxRequestLength 的类型是 Int , 目前无法解析高于 Int.Max 的值正确。

我听说他们可能会增加 IIS8,但到目前为止 Microsoft 还没有具体消息。我在 .Net 4.5 中看到的唯一方法是使用 HttpRequest.GetBufferlessInputStream哪个

Gets a Stream object that can be used to read the incoming HTTP entity body, optionally disabling the request-length limit that is set in the MaxRequestLength property.

关于c# - 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13129746/

相关文章:

c# - 在正则内联表达式中访问数据绑定(bind)变量

iis - 在 IIS 中通过 ssl 和非 ssl(http 和 https)传送文件

c# - LogicalTreeHelper.GetChildren - ObservableCollection Move() 导致 DataTemplate 中的 ContentControl 丢失其内容?

c# - 不兼容可访问性错误,这是什么意思?

c# - 解析 XML 的高效方法

apache - 将 .htaccess 转换为 web.config

ssl - 如何在 sonarqube 中启用 SSL

c# - like 使用参数的 npgsql 语句

c# - 在 visual studio 上使用 c#、mvc 管理我的用户

asp.net - jsonp回调函数没有被调用