I configured my IIS website to be always up and to initialize it after pool recycle. But I'm not sure how it works. This is .NET 6 MVC app.
All instructions say that I need to install Application Initialization role, but "Preload enabled" setting was available for my website even before installing this role. I set it to true but it didn't seem to work. I installed Application Initialization and it started working.
So the first question is what does "Preload enabled" setting do when you don't have Application Initialization installed?
I assume that with above settings IIS is making a request to my Home page. But I'm not sure I will have this page in final version of application.
The second question is, if I remove Home page will auto preloading stop working? If yes, then I need to use applicationInitialization settings in config file and configure it like this?
<add initializationPage="/CustomWarmupPage" hostName="myhost" />
CodePudding user response:
So the first question is what does "Preload enabled" setting do when you don't have Application Initialization installed?
Starting with IIS 8, application initialization is part of the IIS feature set. For IIS 7 and 7.5, it is available as a separate download through the Web Platform Installer. Application initialization with IIS 8 is an optional installation component in Windows or Windows Server Role Manager.
To support application initialization on your Web server, you must install the Application Initialization role or feature. If application initialization is not installed, the "Preload enabled" setting will have no effect.
The second question is, if I remove Home page will auto preloading stop working? If yes, then I need to use applicationInitialization settings in config file and configure it like this?
<add initializationPage="/CustomWarmupPage" hostName="myhost" />
The way this module works is that you introduce a path, and when your ApplicationPool runs, it sends a request to the registered path. System startup should not be delayed until the first request is sent to the program. To do this, you must enter the following command in the system.webServer tag of the web.config file,like:
<applicationInitialization doAppInitAfterRestart="true"
skipManagedModules="true" >
<add initializationPage="/default.aspx" />
</applicationInitialization>
Using the above command, we specify that after the ApplcationPool starts, it will send a "/default.aspx" request to the path entered in the initializationPage parameter, which is the initial setup of the service. Then you need to set the Application Pool Start Mode value to AlyawsRunning and the WebSite PreLoad Enebled value to true to do this automatically. This will always send a request to warm up the app when the app starts or restarts.