我在这里将 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/