Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to ignore the maxRequestLength limit of 2GB file uploads?

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"/>
    ...

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>
    ...

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

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.

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

like image 726
Steven Avatar asked Oct 29 '12 21:10

Steven


People also ask

What is maximum value for maxRequestLength?

HttpRuntime maxRequestLength Use the maxRequestLength of the httpRuntime element. The default size is 4096 kilobytes (4 MB). Max value 2,147,483,647 kilobytes (~82 Terabyte).

What is the max maxAllowedContentLength?

According to MSDN maxAllowedContentLength has type uint , its maximum value is 4,294,967,295 bytes = 3,99 gb. So it should work fine.

What is the use of maxRequestLength?

The MaxRequestLength property specifies the limit for the buffering threshold of the input stream. For example, this limit can be used to prevent denial of service attacks that are caused by users who post large files to the server.


1 Answers

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

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

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.

like image 153
Erik Philips Avatar answered Sep 28 '22 10:09

Erik Philips