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?.

Answers


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:

First request is very slow after website sits idle with ASP.NET MVC 3 (IIS7)


You can compile the views for faster performance.

The documentation is for MVC 3, but it should still work:

Compile Views in Asp.Net MVC 3 with Visual Studio


Need Your Help

Regex to remove this string in C#?

c# regex

I am scripting Agent Jobs using SMO for SQL Server and the resulting script strings have a have parameter and value that I want to remove from the final version I am storing. The portion of the sc...

How to include an enum value in a const string?

c# string enums const

from this question, I know that a const string can be the concatenation of const things. Now, an enum is just a set of cont integers, isn't it ?