If I just browse some pages on the app, it sits at around 500MB. Many of these pages access the database but at this point in time, I only have roughly a couple of rows each for
This could be one of a few things:
As your file is rather large and is stored in your database and you are getting it via Entity Framework
, you are caching this data in a few places. Each EF
request caches that data until your context is disposed. When you return the file from the action, the data is then loaded again and then streamed to the client. All of this happens in ASP .NET
as explained already.
A solution to this issue to not to stream large files directly from the database with EF
and ASP .NET
. A better solution is to use a background process to cache large files locally to the website and then have the client download them with a direct URL. This allows IIS
to manage the streaming, saves your website a request and saves a lot of memory.
OR (less likely)
Seeing that you are using Visual Studio 2013
, this sounds awfully like a Page Inspector
issue.
What happens is when you run your website with IIS Express
from Visual Studio
, Page Inspector
caches all of the response data - including that of your file - causing a lot of memory to be used. Try adding:
to your web.config
to disable Page Inspector
to see if that helps.
TL;DR
Cache the large file locally and let the client download the file directly. Let IIS handle the hard work for you.