Chris Chris - 16 days ago 8
ASP.NET (C#) Question

ASP.NET MVC: First access after some minutes slow, then every following request is fast

when I access any page of my ASP.NET MVC website first time, then this first request is slow. It needs about 4-5 seconds to load. But every following request to any page is fast.

When I wait some minutes or a hour then every first request is slow again. Every following request is fast.

I think that IIS 7 is compiling the code and keep it in memory. After some time it will delete it from memory so it needs to compile it again.

What can I do that every first request is as fast as every following request?
(Without precompiling my source, if possible)

Thank you very much in advance!

Answer

This could be the recycle worker processes setting on the application pool, check the value for that and either turn it off or make it longer.

Could also be the Shutdown worker process after being idle under performance for the application pool.

It's probably the second as that defaults to 20 minutes, the first one defaults to 29 hours I believe.

Comments