IIS (Internet Information Services) · Advanced IIS

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.

Advanced 5 min Lesson 33 of 45Covers IIS 10 on Windows Server 2019/2022/2025 and Windows 10/11.
0/45 in IIS
On this page · 5 min · Advanced

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#

XMLweb.config Illustrative
<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
-->
Expected output
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#

  1. initializationPage entries are requested when the app starts.
  2. doAppInitAfterRestart repeats the warm-up after recycles.
  3. startMode AlwaysRunning starts w3wp.exe without waiting for traffic.
  4. idleTimeout 0 keeps it running.
  5. 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#

Only setting AlwaysRunning

The process starts but the application doesn’t load until Preload Enabled is also True.

Warm-up pages that need login

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
PowerShell Illustrative
Set-ItemProperty IIS:\Sites\Shop -Name applicationDefaults.preloadEnabled -Value True

Mini quiz#

Application Initialization quizMultiple choice Question 1 of 1

Which setting makes IIS load the application right after the worker process starts?

Score so far: 0/0

Want more? Practise all IIS MCQs · IIS interview questions

My notes#

Saved in this browser.

Progress is saved in this browser. Sign in to sync.