app_offline.htm takes an ASP.NET Core app on IIS offline without stopping the application pool, but only when it sits in the right folder and IIS doesn't swap the page. A source-level guide explains the rules, the 503 behaviour and deploy sequences.
Key points
- The ANCM module answers every request with 503 Service Unavailable and sends the file's bytes as text/html.
- The file must sit in the folder holding web.config; subfolders are ignored and the name is case-insensitive.
- In-process hosting shuts the app down and recycles w3wp.exe, waiting up to shutdownTimeLimit, 10 seconds by default.
- No minimum size is required; the old 512-byte rule came from Internet Explorer, not from ANCM.
- httpErrors existingResponse="Replace" discards your maintenance page, so the IIS default of Auto must stay.
- Web Deploy handles the file itself through EnableMSDeployAppOffline in the .pubxml or -enableRule:AppOffline.
Real-world use
- A CI job or robocopy script that must wait for the locked DLL to be released before copying a new build onto a Windows server.
- An ASP.NET Core API on shared Windows hosting with Plesk, deployed by uploading and extracting a zip in File Manager.
- A Visual Studio publish that uses Web Deploy and needs the app offline during the sync.
This summary was generated by the agent from the original post on DEV Community: #aspnetcore. The full text and all rights belong to its author and publisher. Go to original