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

Is there a way to ignore the maxRequestLength limit of 2GB file uploads?(有没有办法忽略 2GB 文件上传的 maxRequestLength 限制?)

本文介绍了有没有办法忽略 2GB 文件上传的 maxRequestLength 限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Here's where I'm setting maxRequestLength to 2GB (the max value), which indicates the maximum request size supported by ASP.NET:

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

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

and here I'm setting the maxAllowedContentLength to 4GB (the max value), which specifies the maximum length of content in a request supported by IIS

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

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

I'd like to be able to upload files up to 4GB, but I'm limited by the maxRequestLength field.

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

I noticed that this third party upload tool (http://www.element-it.com/onlinehelp/webconfig.html) has a ignoreHttpRuntimeMaxRequestLength property, which allows it to upload files up to 4GB.

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

Does anyone know if I can ignore the maxRequestLength value like this other upload tool does?

推荐答案

考虑MaxRequestLength 是一个 Int,目前无法解析高于 Int.Max 正确.

Considering the Type of MaxRequestLength is a Int, at the moment there is no way to parse a value higher than Int.Max correctly.

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

I heard they might be increasing IIS8 but nothing concrete from Microsoft as of yet. The only way I've seen in .Net 4.5 is to use HttpRequest.GetBufferlessInputStream which

获取可用于读取传入 HTTP 实体正文的 Stream 对象,可选择禁用 MaxRequestLength 属性中设置的请求长度限制.

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.

这篇关于有没有办法忽略 2GB 文件上传的 maxRequestLength 限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:有没有办法忽略 2GB 文件上传的 maxRequestLength 限制?

基础教程推荐