I have a problem where going into production for my ASP.NET site without pre-compiling causes more than slow initial-startup - the server actually thrashes with memory and SQL connections going thru the roof. What I think is happening is, as pages in the site compile dynamically, ASP.NET gets to a threshold where it wants to restart the application so it starts a new instance while the old instance spins down, and I end up with multiple instances of my app running.
In any case, I can prevent this by systematically hitting pages on my site after a deployment, but this is pretty time-consuming. So I started looking into compiling the whole site in-place with aspnet_compiler.exe.
But it doesn't seem to do that - I track the ASP.NET Applications / Compilations total and I see that counter race up as I hit pages whether or not I ran aspnet_compiler.exe. I get good compiler output - it seems to work - but pages seem to be compiled dynamically as I hit them anyway.
I studied these two SO discussions:
ASP.NET in-place precompile doesn’t work as expected
and they've left me confused.
So what's the scoop - should I be able to pre-compile everything in-place so that the compilations perf counter stays at zero as I hit pages?