What is the ASP.NET Core Module (ANCM), and what specific role does it play when hosting under IIS?
Short answer
The ASP.NET Core Module (ANCM, specifically ANCM V2) is a native IIS module that acts as the bridge between IIS and an ASP.NET Core application -- for in-process hosting, it hosts the .NET runtime directly within the IIS worker process; for out-of-process hosting, it manages…
Advertisement
AModel answer
The ASP.NET Core Module (ANCM, specifically ANCM V2) is a native IIS module that acts as the bridge between IIS and an ASP.NET Core application -- for in-process hosting, it hosts the .NET runtime directly within the IIS worker process; for out-of-process hosting, it manages starting/monitoring/restarting the separate Kestrel process and proxies requests to it, additionally handling process lifecycle concerns like automatically restarting a crashed app.
<!-- web.config -- installed automatically by the .NET hosting bundle, referenced here -->
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MyApp.dll" hostingModel="inprocess" />
</system.webServer>Real-world example
An IIS-hosted application crashes due to an unhandled exception in a background thread, and the ASP.NET Core Module automatically detects the process failure and restarts it, restoring service without manual intervention, a resilience behavior IIS wouldn't provide for a non-ASP.NET-Core-aware process on its own.
Likely follow-ups
- What needs to be installed on a Windows Server for the ASP.NET Core Module to function (the hosting bundle)?
- How does ANCM's process restart behavior interact with graceful shutdown of in-flight requests?
Related topics