Application Initialization
The first visitor after a deploy or recycle often waits several seconds while the app starts. Application Initialization starts it before anyone arrives.
On this page · 5 min · Advanced
On this page
- Learning objectives
- Explanation
- Step-by-step screens
- Code example
- Step by step
- Real-world use
- Common mistakes
- Best practices
- Remember this
- Practice exercise
- Mini quiz
- Related topics
- My notes
- Reading time
- 5 min
- Difficulty
- Advanced
- Updated
- Nov 26, 2026
Related tutorials
Interview questions
Learning objectives#
- Install the Application Initialization feature
- Set the pool to AlwaysRunning
- Enable preload on the site
- Add a warm-up page in web.config
Explanation#
Install the role service Web Server → Application Development → Application Initialization.
Application pool → Advanced Settings → Start Mode: AlwaysRunning starts the worker process when IIS starts or the pool recycles, instead of waiting for the first request. Set Idle Time-out to 0 so it isn’t shut down when quiet.
Site → Advanced Settings → Preload Enabled: True makes IIS send a fake request to the application as soon as the worker process starts, so ASP.NET Core or ASP.NET loads, compiles and fills caches.
Optionally list warm-up URLs in web.config (applicationInitialization), such as a /health endpoint that touches the database. With doAppInitAfterRestart, it also runs after every recycle.
Step-by-step screens#
Drawings of IIS Manager in IIS 10 (Windows Server 2019/2022, Windows 10/11). The red numbers match the numbered actions under each picture; names on your computer will differ.
Loading pictures…
Code example: Warm-up configuration#
<configuration>
<system.webServer>
<applicationInitialization doAppInitAfterRestart="true" skipManagedModules="false">
<add initializationPage="/health" />
<add initializationPage="/products" />
</applicationInitialization>
</system.webServer>
</configuration>
<!-- PowerShell for the pool and site settings -->
<!--
Import-Module WebAdministration
Set-ItemProperty IIS:\AppPools\ShopPool -Name startMode -Value AlwaysRunning
Set-ItemProperty IIS:\AppPools\ShopPool -Name processModel.idleTimeout -Value '00:00:00'
Set-ItemProperty IIS:\Sites\Shop -Name applicationDefaults.preloadEnabled -Value True
-->
After a recycle, the log shows requests to /health and /products from the warm-up module before the first real visitor; that visitor gets the page in milliseconds instead of seconds.
This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.
Step-by-step explanation#
- initializationPage entries are requested when the app starts.
- doAppInitAfterRestart repeats the warm-up after recycles.
- startMode AlwaysRunning starts w3wp.exe without waiting for traffic.
- idleTimeout 0 keeps it running.
- preloadEnabled sends the start-up request to the application.
Real-world use case#
An ASP.NET Core shop recycled at 3:00 AM and the first morning customer waited 6 seconds. With AlwaysRunning, preload and a warm-up page, the first request takes 80 ms.
Common mistakes#
The process starts but the application doesn’t load until Preload Enabled is also True.
The warm-up request is anonymous; protected pages return 401 and warm nothing. Use a public health endpoint.
Best practices#
- AlwaysRunning + Preload Enabled together
- Idle Time-out 0 for busy sites
- Warm up the database connection too
- Schedule recycles at quiet hours
Remember this#
Pool: AlwaysRunning.
Site: Preload Enabled = True.
web.config: initializationPage.
Practice exercise#
Your task: Write the PowerShell line that enables preload on the Shop site.
Show solution
Set-ItemProperty IIS:\Sites\Shop -Name applicationDefaults.preloadEnabled -Value True
Mini quiz#
Which setting makes IIS load the application right after the worker process starts?
Want more? Practise all IIS MCQs · IIS interview questions
My notes#
Saved in this browser.