2 GB file upload limit exceeded in IIS 7.5 and .NET

I have an intranet application that must download (.iso) files larger than 2 GB. It appears that there are many restrictions for a 2 GB file size.

  • IE has a browser limitation, and only IE 9/10 can exceed 2 GB According to Eric Law
  • The maxRequestLength httpRuntime element is of type Int32, which has a maximum value of 2097151, approximately 2 GB.

It looks like you can set another file size size from maxAllowedContentLength to about 4 GB as it is of uint type, but what good does it do when we are still limited to 2 GB from maxRequestLength?

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

Does anyone have solutions for downloading files beyond 2 GB?

+7
source share
3 answers

Are you open for JavaScript? If in this case, try this jQuery plugin, which allows you to load massive data (lots of GB). It downloads files using the HTML5 FileReader API functions and Silverlight reserve if the browser does not have support providing a mechanism based on sending and receiving TCP / IP packets with the corresponding ACK. Files are uploaded in pieces by size (4 MB by default).

Plus: it also has a file queue mode.

Here is an example of how you can use it in a Razor view:

 $(function () { var file = $("#file").createUploaderHtml5({ postDataUrl: "@Url.Action("Upload", "Home")", packetSize: 4 * 1024 * 1024, onPreparingUpload: function (plugin, ufname, umime, usize) { plugin.settings.logger("ufname = [" + ufname + "] umime = [" + umime + "] usize = [" + usize + "]"); return true; }, onInitPacketArrived: function (plugin, guid) { plugin.settings.logger("guid = [" + guid + "]"); }, onDataPacketArrived: function (plugin, ack, total) { //plugin.settings.logger("ACK [" + ack.Guid + "] packet = [" + ack.Packet + "] total = [" + total + "]"); var percent = Math.round(ack.Packet / total * 100); $("#progressbar").attr("value", percent); $("#percent").html(percent + " %"); }, onFileUploaded: function (pl) { pl.settings.logger("File finished!!!"); }, logger: function(msg) { var lg = $("#logger"); lg.html(lg.html() + msg + "<br />"); } }); $("#start").click(function () { file.startUpload(); }); $("#stop").click(function () { file.cancelUpload(); }); }); 

Here is the action code to download:

 [HttpPost] public ActionResult Upload(FormCollection collection) { var packetSize = 4 * 1024 * 1024; // default to 4 MB var filePath = Server.MapPath("~/_temp_upload/"); var result = UploadHelper.ProcessRequest(Request, filePath, packetSize); if (result != null) { var metadata = UploadHelper.GetMetadataInfo(filePath, result.Guid); // do anything with the metadata } if (result != null) return Json(result); return Content(""); } 
+4
source

This year I fought a lot with large files uploaded from different browsers to the IIS server. Here is what I found:

ASP.NET supports downloading more than 2 GB with .Net 4.5 (it may support files up to long.MaxValue ). But IIS itself does not support downloading more than 2 GB. Thus, any server hosted in IIS does not support loading more than 2 GB.

As far as I know, the value maxAllowedContentLength or maxRequestLength for values ​​over 2 GB does not help, because these parameters are for ASP.NET, and the main problem is in IIS.

+1
source

One option is to use the latest version of AjaxControlToolkit, which supports "chunking" in its file upload control, that is, it splits the file into smaller fragments using the html5 api file and sends it.

I don't know if this works around a common file size issue, but is it worth exploring?

http://stephenwalther.com/archive/2013/04/30/april-2013-release-of-the-ajax-control-toolkit.aspx

-one
source

All Articles