I'm trying to debug a problem in our ASP.Net application, whereby the first page access can take up to five minutes. This site runs in .Net 3.5 and has 100 ascx controls and 25 aspx pages, so it's not small.
What I've noticed is that when the site is really slow to load the Temporary ASP.Net files folder is being repopulated. Fully loaded and running that folder is ~ 50 to 70 MB total, with anywhere from 2000-3000 files in it.
I'm a little confused as to how and when that folder is cleared out? Starting from scratch with an empty folder the site takes 5 minutes to load. But under regular recompilations, maybe a file or two changed, the site comes up in 30 seconds after a rebuild.
What I don't understand is when the folder is cleared out-- sometimes even after I run a clean and rebuild all on the solution, with an iisreset and web.config change thrown in for good measure, that folder has nearly the same number of files as before when the site reloads and it only takes 30 seconds to come up. (We are using the 'optimizeCompilations' flag in web.config)
Other times, under other build circumstances I can't explain, we're back to the 5 minute load times as the folder completely rebuilds itself.
When is this folder cleared out and is there anything I can do to speed up its repopulation time when it needs to start from scratch? (70 megabytes in 5 minutes seems a little slow?)