HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure
IIS started your ASP.NET Core worker process but it crashed or exited before it could accept proxied requests.
What you see
HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure Common causes of this issue: The application process failed to start / The application process started but then stopped / The application process started but failed to listen on the configured port.
What’s actually happening
The page returns a 502.5 instead of your app. This is the out-of-process hosting model talking: the ASP.NET Core Module (aspnetcorev2_outofprocess.dll) spawns dotnet.exe as a reverse-proxy backend, and that child process died on startup or never bound to its assigned port. The in-process equivalent is 500.30/500.31, so seeing 502.5 specifically tells you hostingModel is OutOfProcess. The error page itself carries almost no detail; the real reason is in the stdout log or the Windows Event Log.
Common causes
- The targeted .NET runtime isn't installed on the box — web.config asks for Microsoft.AspNetCore.App 8.0.x but only 6.0.x is present, so the host throws 'The specified framework was not found.'
- processPath or arguments in web.config are wrong: dotnet.exe not on PATH for the app pool identity, or arguments pointing at a .dll that isn't in the publish output.
- The app throws during Program.cs / Startup before Kestrel binds — a bad connection string, missing appsettings.json, or a DI registration that blows up in the constructor.
- Bitness mismatch: a 32-bit published app under an app pool with 'Enable 32-Bit Applications = False' (or the reverse).
- Port conflict or the app exited non-zero immediately; ANCM waits for the port and reports the process started-then-stopped.
How to fix it
- Read the actual exception from the Event LogOpen Event Viewer > Windows Logs > Application and filter on source 'IIS AspNetCore Module V2', EventID 1010. The message names the failing application path and an ErrorCode like 0x800700c1 (bad image / bitness) or a framework-not-found string. This is faster than guessing.
- Turn on stdout loggingIn web.config set stdoutLogEnabled="true" and stdoutLogFile=".\logs\stdout", create the logs folder, and give the app pool identity (e.g. IIS AppPool\YourPool) write access. Reproduce the request, then read the newest .\logs\stdout_*.log — the unhandled exception and stack trace land there.
- Run the app by hand from the deploy folderOpen a cmd in the publish directory and run: dotnet .\YourApp.dll (framework-dependent) or .\YourApp.exe (self-contained). You'll see the crash immediately with full output, with IIS removed from the equation.
- Install or retarget the runtimeRun dotnet --list-runtimes on the server. If the version your app needs is missing, install the ASP.NET Core Hosting Bundle for that major version and run iisreset. Alternatively publish self-contained (dotnet publish -c Release --self-contained -r win-x64) so the runtime ships with the app.
- Verify processPath/arguments and bitnessConfirm <aspNetCore processPath="dotnet" arguments=".\YourApp.dll" /> matches the actual DLL name, and that the app pool's 32-bit setting matches how the app was built. After any web.config change, recycle the app pool.
Stop it recurring
Install the matching ASP.NET Core Hosting Bundle as part of provisioning and smoke-test the published DLL with `dotnet YourApp.dll` before wiring up IIS.