HTTP Error 500.0 — ANCM In-Process Handler Load Failure

Are you see the following page when running ASP.NET API/App? This short guide might help you.

I have seen this multiple times in different machines/servers. This happens mainly with ASP.NET Core InProcess hosting.

Troubleshooting guide:

  • Install ASP.NET Core hosting bundle for specific .NET Core version e.g. .NET Core 2.2. Download it from .NET core 2.2 (Change the version from URL).
  • After step 1, you may still see the issue because of different bitness. Use SysUtil(sigcheck.exe) to check your binary (64-bit or 32-bit).
  • If you are using 32-bit then enable 32-bit in the App pool. Go to the advance settings of the app pool and set true to Enable 32-bit Applications.
  • You may still see the issue; now check your app pool identity has permission to invoke Donet.exe and has write permission if you want to see logs to the file. This was one of the issue on the server and doesn’t look related to this error.

Web.config configuration (This is only for local development machines)

<aspNetCore processPath="C:\Program Files\dotnet\dotnet.exe" arguments="exec "D:\api\bin\x64\Debug\netcoreapp2.2\myapi.dll"" stdoutLogEnabled="true" hostingModel="InProcess" stdoutLogFile=".\logs\stdout\"><environmentVariables><environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development"/></environmentVariables></aspNetCore>
  • Microsoft team recommend to add UseIIS() to the pipeline for InProcess hosting in program.cs file. For OutProcess use IISIntegration(). Note: Once you enable IIS then, you may not be able to launch EXE or running DLL with dotnet executable.

program.cs

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>WebHost.CreateDefaultBuilder(args).ConfigureLogging(logging =>{logging.ClearProviders();logging.AddEventLog();}).UseIIS().CaptureStartupErrors(true).UseStartup<Startup>();

I hope this helps!