My ASP.net MVC 4 site gets slow on first request to SQL Server Express 2012
I have an ASP.net MVC 4 site and it gets slow on the first request. It is not high slow but pages that use to long 1000-700 ms on load, the first time it longs 8-15seg. It occurs when i wait for 10 minutes for example and come back to make a request. The web site is not on production server yet. May it be when the app pool does not receive any request it goes to sleep?.
I have configured the new AutoStart mode in framework 4: http://weblogs.asp.net/scottgu/archive/2009/09/15/auto-start-asp-net-applications-vs-2010-and-net-4-0-series.aspx
I think it may be the first request to the SQL Server Express 2012 (in the same server). I have set the autoclose=off in the database.
What more can i do?. How could i see what is going on the first request to avoid that slow response?.
Thanks to every one who has apported to this question. Finally i think it has to do with the idle time configuration in the App pool. It was set 5 min (default) and i have set it 60 min. and now it goes fine!
Thanks to this question:
You can compile the views for faster performance.
The documentation is for MVC 3, but it should still work: