Lessons in this course (9)

3. Application pools — identity, pipeline mode, recycling and isolation

Intermediate★ Must knowLesson 3 of 9
SettingOptions / defaultNotes
.NET CLR versionv4.0 / v2.0 / No Managed CodeASP.NET Framework 4.x → v4.0; ASP.NET Core → No Managed Code
Managed pipeline modeIntegrated / ClassicIntegrated = ASP.NET modules in the IIS pipeline (use this); Classic = legacy ISAPI style
IdentityApplicationPoolIdentity / NetworkService / LocalSystem / custom accountApplicationPoolIdentity = virtual account IIS AppPool\ShopPool — grant folder permissions to it
Enable 32-bit applicationsFalseTrue only for old 32-bit native dependencies
Start modeOnDemand / AlwaysRunningAlwaysRunning + Application Initialization removes the first-request delay
Idle timeout20 minutesSet 0 for always-warm apps
Regular recycling1,740 minutesSchedule at a quiet time or disable if not needed
Rapid-fail protection5 failures in 5 minutesPool stops → 503 Service Unavailable
Maximum worker processes1>1 = "web garden" (in-process session/cache not shared)
powershell
Set-ItemProperty IIS:\AppPools\ShopPool -Name managedRuntimeVersion -Value ""          # No Managed Code (ASP.NET Core)
Set-ItemProperty IIS:\AppPools\ShopPool -Name startMode -Value AlwaysRunning
Set-ItemProperty IIS:\AppPools\ShopPool -Name processModel.idleTimeout -Value "00:00:00"
icacls C:\sites\shop /grant "IIS AppPool\ShopPool:(OI)(CI)RX"                            # read & execute for the pool identity
icacls C:\sites\shop\logs /grant "IIS AppPool\ShopPool:(OI)(CI)M"                        # modify for log folder
Restart-WebAppPool -Name ShopPool

Recycling starts a new worker process and drains the old one (overlapped recycle) — in-memory state (InProc session, caches, static variables) is lost. That's why web farms and recycles need out-of-process session (SQL/Redis).

Database access with ApplicationPoolIdentity: with Windows authentication to SQL Server on the same machine, create a login for IIS AppPool\ShopPool; for a remote SQL Server, the machine account (DOMAIN\WEBSERVER$) is used — or run the pool as a domain service account / use SQL authentication.