我需要将 10Gb 文件一次性上传到 IIS。据我所知,IIS 7.x / ASP.NET 4.0 不支持超过 2Gb(有人说是 4Gb)的上传。
它在 IIS 8 / ASP.NET 4.5 中修复了吗?
我需要将 10Gb 文件一次性上传到 IIS。据我所知,IIS 7.x / ASP.NET 4.0 不支持超过 2Gb(有人说是 4Gb)的上传。
它在 IIS 8 / ASP.NET 4.5 中修复了吗?
这是我上传低于 4GB 的方法(我也想知道如何打破这个限制):应用程序池是 .NET 4.0 经典模式(为什么没有 4.5?)。网络配置:
<httpRuntime executionTimeout="2400" maxRequestLength="2099999999" />
...
<requestLimits maxAllowedContentLength="4294967290"/>
根据这篇文章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;
}
}
日志说 .NET 4.5 中的方法被毫无例外地调用。但是这个链接http://aspnet.uservoice.com/forums/41199-general-asp-net/suggestions/2642879-maximum-upload-size-in-asp-net-is-2gb-increase-it说:“完成. 这个限制在 4.5 中增加了。”
所以我只有一个问题:“如何?”