0

Regarding ASP.NET Autostart/Prewarm, (see this page for example http://weblogs.asp.net/scottgu/archive/2009/09/15/auto-start-asp-net-applications-vs-2010-and-net-4-0-series.aspx) what should I put within the preload function code in the assembly file you're supposed to create for this? I did have something when I attempted this, but can not recall since I had scrapped the initial class file I had created. It didn't do anything to speed up the site in question, but I'm wondering if maybe I was missing something in this class that I should have had?

public class PreWarmCache : System.Web.Hosting.IProcessHostPreloadClient {
    public void Preload(string[] parameters) 
    {
        // What goes here?
    }
}
SausageBuscuit
  • 1,226
  • 2
  • 20
  • 34

2 Answers2

2

A far simpler solution is to use the Application Initialization Module for IIS 7.5 which will improve the responsiveness of the Web site by loading the Web application before the first request arrives:

Auto Starting Websites on IIS 7.5

IrishChieftain
  • 15,108
  • 7
  • 50
  • 91
  • I have attempted this, but the improvement I saw was marginal at best. I had posted a different question to my main problem here: http://stackoverflow.com/questions/19526373/asp-net-web-application-slowness/19532640?noredirect=1#19532640. I verified that the w3wp process is running and restarting as described in your 2nd link. – SausageBuscuit Oct 23 '13 at 14:17
  • If there is database access, then that is a potential culprit. Either way, turn on the Trace property in the page directives. This will help narrow down the particular part of the life cycle where the bottleneck is occurring. – IrishChieftain Oct 23 '13 at 14:48
  • 1
    Since you have issues on pages with no DB access, you need to narrow it down: http://msdn.microsoft.com/en-us/library/ff647813.aspx – IrishChieftain Oct 23 '13 at 15:06
  • 1
    Updated the previous question...is related to service called 51degrees.mobi that is used for mobile redirection. After I fixed, I disabled application initialization just for curiosity, and it does give me a small performance boost, whereas when my other issue was happening, I couldn't really see the benefit. – SausageBuscuit Oct 23 '13 at 19:02
0

What goes there is any code that you wish to run to "warm up" your application. If, for example, on startup you read 1000 objects from a database and put them in memory, do that in this method instead of Application_Start.

Haney
  • 32,775
  • 8
  • 59
  • 68