Reputation: 4691
I have several MVC4 sites on my VPS. They all have the same issue. They are so slow (up to 10 seconds to load, which is not a good first impression).
I am aware that when you first load your site, it will take a little while due to various things I've read upon. I understand this.
The problem is the following situation is true.
Publish MVC4 site to server.
Load MVC4 site in browser a PC. Site takes a while to load but expected.
Look at other pages on the site. A few are slow, but generally all is OK.
Close the website.
Reopen the website.
All pages respond well.
Close the website.
Leave it idle for 1 hour.
Open website, it is slow again, as if it's only been published
I can only assume it's something to do with the session, IIS or the app pool
In webforms I used to have tracing, I don't appear to have that in MVC and I don't know how I can debug such an issue.
Upvotes: 3
Views: 1131
Reputation: 11396
That's actually the expected behavior, given that after a period of inactivity the application pool will recycle, to free up unused resources. Check the application pool's Recycle settings to configure that duration.
If you also want additional control on what happens during recycling there are a few options:
IIS7.5 (ASP.NET 4) supports a feature called "AutoStart", which can warm up your site after deployment and after recycling.
IIS8 has additional support through the Application Initialization Module.
Upvotes: 3