IIS Site Slow to Load on First Visit/Load (SiteFinity)

I had to deploy a new website that was done by a web design company, it was created in Sitefinity. I didn’t have the option to install it, I simply was given the site files and the database. I think had to figure out a way to update the database configuration file, of which Sitefinity doesn’t really have much documentation on. I will post if I find anything related on how to update the Sitefinity database connection strings in the Sitefinity configuration file.

I was able to get Sitefinity working, and the content was displaying properly. However after a little while the site would begin to load slowly, but only on the first page load. I could tell it had something to do with the idle timeout for the application pool in IIS 7.5

Digging further I found the following article that talks about auto start for ASP.NET applications.

http://weblogs.asp.net/scottgu/archive/2009/09/15/auto-start-asp-net-applications-vs-2010-and-net-4-0-series.aspx

I also find this article about Sitefinity and auto start but not much information on how to implement it properly.

http://patrickdunn.me/blog/posts/2012/10/18/auto-start-sitefinity-iis

I then found the following two articles.

http://scottrozman.net/blog/12-07-27/Sitefinity_5_x_Performance.aspx
http://www.techbubbles.com/aspnet/auto-start-web-applications-in-aspnet-40/

The last article from techbubbles.com talks about the preloadEnabled=”true” and preloadProvider=”PrewarmMyCache” of which just cause IIS 7.5 not to start. Because its not valid XML. The error was

The worker process for application pool 'site' encountered an error 'Configuration file is not well-formed XML ' trying to read global module configuration data from file '\\?\C:\inetpub\temp\apppools\site\site.config', line number '3'. Worker process startup aborted.

I later found out this is because preloadEnabled is actually is a property for the “Application Initalization” module.

http://www.iis.net/downloads/microsoft/application-initialization

This property is available by default in IIS 8.0, hence why you might see some documentation talking about it but no the “Application Initalization” module.

So, if you want to be able to use the preloadEnabled property you will need to install the “Application Initalization” module. Just a note on the installation, you will need the x64 binary which is available under “Additional Downloads” at the bottom of the page. You will also be asked to reboot, so if this is a production server, schedule a maintenance.

The following page will go over how to use the Application Initialization Module.

http://blogs.iis.net/wadeh/archive/2012/05/01/application-initialization-part-2.aspx

That’s it!