I have an ASP.net 3.5 application running on Windows Server 2003 and IIS 6.0 that when my code reads a 16MB file I sometimes get an OutOfMemory exception. Usually if you try to perform the same read again I continue to get the exception.
If I restart w3svc then the exception goes away. Also it tends to go away if I leave it alone for a few hours and try running the code later.
The exception comes from a call to ReadToEnd on the file stream, so it's not something in my code leaking memory.
The w3wp.exe process on my website is usually using about 250-350MB of memory under normal load.
I would guess that something about per-connection memory usage or something is causing this problem, though I don't know enough about the IIS / ASP.net memory management to know where to look for a way to track this down or tweak it to not cause the problem.
I almost always have 2+GB free RAM on this server, and am never below 1.5GB free.
I've run this same application / code for years on these servers and this exception only started recently. My guess is that it started when the file slowly grew above 16M, but that could just be a coincidence. The file most definitely slowly grows so a few months ago when I was never having this problem, it was most definitely a bit smaller than it is now.
The offending code is probably run 5-6 times a day (reading in a cache) and seems to error once or twice a week so it does not always error, but its frequent enough that it is becoming a problem.
Is there some sort of limit to the IIS connection or the ASP.net website that I'm hitting and if so is there a way to increase the limit when I know I have loads of free RAM?
0 Answers