Shaun Xu
Shaun Xu

Reputation: 4656

Memory usage if upload big file in one request in IIS

I'm going to implement a website in ASP.NET MVC with IIS7/8 and I need to upload big file (several GB). I knew that I can change the configuration in web.config to upload up to 4GB file. But I was a little bit concern about the memory usage.

If I uploaded a 3GB file in one request (just use a web page with one form, one file input element and one submit element), will it consume 3GB memory of my server? Or will IIS 7/8 automatically pass the content through Request.InputStream in chunks so that the server side memory usage could be acceptable? If so, do I need to configure the IIS to support chunk receiving?

Upvotes: 2

Views: 1486

Answers (1)

Rajeev Bera
Rajeev Bera

Reputation: 2019

IMO for such amounts of data (more then 1 GB) you may use ftp. That's what this technology is meant for. If you will make use of asp.net control for such huge amount of data is simply not the best way to go. You may also consider (NeatUpload)[http://neatupload.codeplex.com

And to answer of your question

During the upload process, ASP.NET loads the whole file in memory before the user can save the file to the disk or in the databae Therefore, the process may recycle because of the memoryLimit attribute of the processModel tag in the Machine.config file.

you may get many different error if you will try to upload such large files

The page cannot be displayed

and

Server Application is Unavailable

and Exception of type System.OutOfMemoryException was thrown.

You may read more here http://support.microsoft.com/kb/323246

Hope it will helps

Upvotes: 3

Related Questions