Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS 8.5 - Application initialization not working

I have installed Application Initialization, set the website's application pool Start Mode to "Always Running", and set Preload Enabled = "True" in the advanced settings of the website.

However, if I recycle the application pool manually and wait 10 seconds, when I then reload the website, I still have to wait another 10 seconds for the website to warm up. This indicates that the website is not starting.

Looking at task manager, I can see that the application pool is running the whole time - even after a recycle. However, the memory usage is very low until I make my own request to the website.

One thing I have noticed is that I do not have a "Start Automatically" setting in the advanced settings of my website as per this link: https://blogs.msdn.microsoft.com/vijaysk/2012/10/11/iis-8-whats-new-website-settings/

How can I get my application to auto-start?

like image 599
Laurence Frost Avatar asked Feb 18 '16 11:02

Laurence Frost


3 Answers

If anyone's wondering what to do in MVC when you have multiple areas to initialise, you need to put the area at the start, all within the root web.config file. I was stuck for a while trying to put it in the area's web.config. Also it's perfectly compatible with hybrid applications.

<add initializationPage="/NotMVC.aspx" />
<add initializationPage="/Area1/Controller/Action" />
<add initializationPage="/Area2/Controller/Action" />
like image 68
George Avatar answered Oct 05 '22 18:10

George


Try Application Initialization setup:

I had similar issues and tried very hard with IIS 8.5 Windows Server 2012 R2. Everything in the IIS was set correctly after referring to so many sites however had missed the Application Initialization setup. Refer to the below link, Setup section.

enter image description here

https://www.iis.net/configreference/system.webserver/applicationinitialization

like image 37
Guru_07 Avatar answered Oct 05 '22 19:10

Guru_07


There are multiple .config locations where these settings can be set.

  1. Machine applicationHost.config (c:\windows\system32\inetsrv\Config)
  2. Website web.config (c:\inetpub\wwwroot for Default Web Site)
  3. Application web.config

I tried all but was only successful in configuring 3, the application web.config. My specific use case was calling a GET method on a WCF service.

The steps for application initialization are found in the other answers too. Here is one that was most helpful. IIS 8.0 Application Initialization

  1. Install the Windows feature Application Initialization (Web-AppInit)
  2. Set the IIS app pool Start mode = AlwaysRunning
  3. Set the IIS application Preload Enabled = true
  4. Add to the application web.config

    <system.webServer>     
        <applicationInitialization doAppInitAfterRestart="true" skipManagedModules="true">
            <add initializationPage="/Service.svc/Method/Parameter" />
        </applicationInitialization>
    </system.webServer> 
    
  5. Recycle app pool

  6. Check that the app initialized.

The thing I would like to point out is that the initialization page is relative to the application NOT to the root of the website/domain so if my absolute path is

domain.com/path1/path2/Service.svc

I would not include /path1/path2 in the initializationPage parameter.

like image 44
Gerard Sexton Avatar answered Oct 05 '22 20:10

Gerard Sexton