Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
333 views
in Technique[技术] by (71.8m points)

large files - Is there any memory restrictions on an ASP.Net application?

I have an ASP.Net MVC application that allows users to upload images. When I try to upload a really large file (400MB) I get an error.

I assumed that my image processing code (home brew) was very inefficient, so I decided I would try using a third party library to handle the image processing parts.

Because I'm using TDD, I wanted to first write a test that fails. But when I test the controller action with the same large file it is able to do all the image processing without any trouble.

The error I get is "Out of memory".

I'm sure my code is probably using a lot more memory than it needs to but I just want to know why my test passes.

The other difference is that I'm using SWFUpload which is not used with the test. Could this be the cause?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There can be memory limits configured in either the web.config or machine.config, or both.

In web.config the section is:

<httpRuntime 
executionTimeout="3600" 
maxRequestLength="102400"
/>

In machine.config the section can also be the httpRunTime section, similar to:

<httpRuntime 
executionTimeout="90" 
maxRequestLength="4096"
useFullyQualifiedRedirectUrl="false" 
minFreeThreads="8" 
minLocalRequestFreeThreads="4"
appRequestQueueLimit="100"
/>

The aspnet process can also be limited to a percentage of the total memory using the processModel section, see:

http://msdn.microsoft.com/en-us/library/7w2sway1.aspx

I've encountered similiar problems to the one you described cause by those settings.
In particular the ProcessModel memorylimit attribute.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...