In Internet Information Services (IIS), application pools have two distinct but related startup controls:
- "Start application pool immediately": A basic setting checkbox that forces immediate initialization
- Start Mode (Advanced Setting): Offers "OnDemand" or "AlwaysRunning" configuration options
The "Start application pool immediately" setting performs a one-time action during IIS configuration changes. When checked, it:
- Triggers immediate startup of the worker process
- Doesn't persist after server reboots
- Primarily used for testing configurations
Contrast this with the Start Mode setting "AlwaysRunning", which:
- Persists across server reboots
- Guarantees the application pool starts automatically with IIS
- Works in conjunction with Application Initialization Module
Here's how to configure these settings programmatically using PowerShell:
# Set "Start immediately" behavior (one-time)
Import-Module WebAdministration
Start-WebAppPool -Name "MyAppPool"
# Configure persistent AlwaysRunning mode
Set-ItemProperty "IIS:\AppPools\MyAppPool" -Name startMode -Value "AlwaysRunning"
# Verify settings
Get-ItemProperty "IIS:\AppPools\MyAppPool" | Select-Object Name, State, StartMode
The "AlwaysRunning" mode significantly impacts:
- Cold start performance - eliminates initial load delay
- Memory usage - maintains worker processes continuously
- Application warmup - enables pre-loading of applications
Scenario | Recommended Setting |
---|---|
Development/Testing | "Start immediately" checkbox |
Production environments | AlwaysRunning + Application Initialization |
Resource-constrained servers | OnDemand mode |
For optimal performance in AlwaysRunning mode, combine with these applicationHost.config settings:
<applicationPools>
<add name="MyAppPool" startMode="AlwaysRunning">
<processModel idleTimeout="00:00:00" />
</add>
</applicationPools>
<sites>
<application path="/" applicationPool="MyAppPool">
<virtualDirectory path="/" physicalPath="C:\sites\mysite" />
<application preloadEnabled="true" />
</application>
</sites>
In IIS (Internet Information Services) application pool configuration, two settings often cause confusion for developers and administrators:
- Start application pool immediately: A basic setting checkbox in the IIS Manager
- Start Mode: An advanced setting with "OnDemand" and "AlwaysRunning" options
"Start application pool immediately" affects the initial state when IIS starts:
// PowerShell equivalent for immediate start
Import-Module WebAdministration
Set-ItemProperty "IIS:\AppPools\MyAppPool" -Name autoStart -Value $true
Start Mode="AlwaysRunning" is part of the IIS Application Initialization module and works differently:
// Web.config implementation example
<applicationPools>
<add name="MyAppPool" startMode="AlwaysRunning" />
</applicationPools>
Scenario | Start Immediately | AlwaysRunning |
---|---|---|
IIS Service Restart | Pool starts immediately | Pool starts AND initializes apps |
First Request | May experience cold start | Pre-warmed and ready |
Idle Timeout | Subject to recycling | Maintains active state |
For high-availability applications, combining both settings is often optimal:
// Recommended configuration for production
<applicationPools>
<add name="CriticalAppPool"
autoStart="true"
startMode="AlwaysRunning"
startImmediately="true">
</add>
</applicationPools>
- Start Immediately: Development environments where quick restarts are needed
- AlwaysRunning: Production environments requiring zero-downtime deployments
- Both: Enterprise applications with strict SLA requirements
If you're experiencing unexpected behavior:
# Check current settings in PowerShell
Get-ItemProperty "IIS:\AppPools\MyAppPool" |
Select-Object name, autoStart, startMode