Here's how I download below 4 GB (I wonder how to break this limit): The application pool is the classic .NET 4.0 mode (why not 4.5?). web.config:
<httpRuntime executionTimeout="2400" maxRequestLength="2099999999" /> ... <requestLimits maxAllowedContentLength="4294967290"/>
In accordance with this article http://msdn.microsoft.com/en-us/library/hh195435%28v=vs.110%29.aspx
public override Stream InputStream { get { object workerRequest = ((IServiceProvider)HttpContext.Current).GetService(typeof(HttpWorkerRequest)); bool webDevServer = workerRequest != null && workerRequest.GetType().FullName == "Microsoft.VisualStudio.WebHost.Request"; if (request.GetType().Assembly.GetName().Version.Major >= 4 && !webDevServer) { try // trying to set disableMaxRequestLength true for .NET 4.5 { return (Stream)typeof(HttpRequest).GetMethod("GetBufferlessInputStream", BindingFlags.Public | BindingFlags.Instance, null, new[] { typeof(bool) }, null) .Invoke(request, new object[] { true }); } catch (NullReferenceException) { // .NET 4.0 is not patched by adding method overload Log(DateTime.Now + ": Can not invoke .NET 4.5 method"); } return (Stream) typeof (HttpRequest).GetMethod("GetBufferlessInputStream", BindingFlags.Public | BindingFlags.Instance, null, new Type[0], null) .Invoke(request, new object[0]); } return request.InputStream; } }
The magazine says that the method from .NET 4.5 is called without exception. But this link http://aspnet.uservoice.com/forums/41199-general-asp-net/suggestions/2642879-maximum-upload-size-in-asp-net-is-2gb-increase-it says: "Finished . This limit is increasing at 4.5. "
So, I have only one question: "HOW?"
source share