IIS app pool recycle + quartz scheduling

Solution 1:

Yes!

http://weblogs.asp.net/scottgu/archive/2009/09/15/auto-start-asp-net-applications-vs-2010-and-net-4-0-series.aspx details it quite nicely, basically you need to:

  1. Edit C:\Windows\System32\inetsrv\config\applicationHost.config to include:

    <applicationPools> 
        <add name="MyAppWorkerProcess" managedRuntimeVersion="v4.0" startMode="AlwaysRunning" /> 
    </applicationPools>
    
  2. Declare what should be run as the "warm-up" for your site

    <sites> 
        <site name="MySite" id="1"> 
            <application path="/" serviceAutoStartEnabled="true" serviceAutoStartProvider="PreWarmMyCache" />
        </site> 
    </sites>
    <serviceAutoStartProviders> 
        <add name="PreWarmMyCache" type="PreWarmCache, MyAssembly" /> 
    </serviceAutoStartProviders> 
    
  3. Configure your application with whatever "warm-up" logic you would like:

    public class PreWarmCache : System.Web.Hosting.IProcessHostPreloadClient {
        public void Preload(string[] parameters) { 
            // Perform initialization and cache loading logic here... 
        } 
    } 
    

Note: If all you need is for the w3wp.exe process to be present I believe only step 1 is necessary. If you also need other items (like certain things to be loaded into memory) then step 2 and 3 would also be used.

Solution 2:

Starting with IIS 8.0, there is an option to simulate a request to the root page, thus a full application initialization: Application Pool advanced settings -> Preload enabled = true.

Of course, startMode should be AlwaysRunning.

More details about how to enable this feature can be found here.