内存使用情况,如果在IIS中的一个请求中上传大文件 [英] Memory usage if upload big file in one request in IIS

查看:160
本文介绍了内存使用情况,如果在IIS中的一个请求中上传大文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要用IIS7 / 8在ASP.NET MVC中实现一个网站,我需要上传大文件(几个GB)。我知道我可以在web.config中更改配置,以上传最多4GB的文件。如果我在一个请求中上传了一个3GB的文件(只要使用一个表单的网页,一个文件的输入元素和一个提交元素),它会消耗我的服务器3GB内存?或者,IIS 7/8会自动将内容通过Request.InputStream以块的形式传递,以便服务器端的内存使用情况可以接受?如果是这样,我需要配置IIS以支持块接收?

解决方案

IMO对于这样的数据量(超过1 GB)你可以使用ftp。这就是这项技术的意义所在。如果您将使用asp.net控件来处理这么大量的数据,那么这不是最好的选择。你也可以考虑
(NeatUpload)[ http://neatupload.codeplex.com



并回答你的问题



在上传过程中,ASP.NET会将整个文件加载到内存中,然后用户可以将文件保存到磁盘或数据库中因此,由于Machine.config文件中的processModel标记的memoryLimit属性,进程可能会重新启动。



许多不同的错误,如果你会尝试上传这样的大文件

 页面无法显示

 服务器应用程序不可用


抛出了System.OutOfMemoryException类型的异常。



您可以在这里阅读更多 http://support.microsoft.com/kb/323246



希望它能帮助


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?

解决方案

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

这篇关于内存使用情况,如果在IIS中的一个请求中上传大文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆