You can find very good guides for debugging the most common types of scripts for freezing, performance, memory, and crashing with .NET and ASP.NET here: .NET Debugging Demos - tuning and tuning instructions . These series are really worthy of attention, because they are full of information, but it takes quite a lot of time :-)
One of the common problems for server applications is allocating tons of "large" .NET objects that fall into the "Big heap of objects . " Check to see if you are actually doing a lot of byte[] or MemoryStream allocations exceeding 85Kb (objects with an adjacent size are larger than it will be in LOH, and this heap cannot be compacted). This typically happens if you create a large number of files (PDF, images, etc.), Copy, etc. This should be done using pure streaming without full-size allocations.
source share