我需要上传10 in的文件到IIS在一块。据我所知,IIS7.x/ ASP.NET 4.0不支持超过2 4Gb的上传(有人说是4 4Gb)。
在IIS8/ ASP.NET 4.5中修复了吗?
发布于 2012-08-01 16:00:58
下面是我如何上传4 4GB以下的内容(我也想知道如何突破这个限制):应用程序池是.NET 4.0经典模式(为什么没有4.5?)web.config:
<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中增加了。”
所以我只有一个问题:“怎么做?”
https://stackoverflow.com/questions/8990787
复制相似问题