Asp.net-core – .NET Core 2.2 – “HTTP Error 500.30 – ANCM In-Process Start Failure”

.net coreasp.net-core

When hosting an ASP.NET Core MVC application on Windows Server 2016 data center running IIS 10, the application fails to load with the message:

HTTP Error 500.30 – ANCM In-Process Start Failure

I created the application with Visual Studio 2017 (9) using .NET Core 2.2 although I installed .NET Core 2.2.3 on the server.

On the server:

dotnet --info
.NET Core SDK (reflecting any global.json):

 Version:   2.2.105
 Commit:    7cecb35b92

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.14393
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.2.105\

Host (useful for support):
  Version: 2.2.3
  Commit:  6b8ad509b6

.NET Core SDKs installed:
  2.1.4 [C:\Program Files\dotnet\sdk]
  2.2.105 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Windows Application Event Log shows:

Application '/LM/W3SVC/3/ROOT' with physical root 'C:\inetpub\wwwroot\healthmonitormvc' failed to load clr and managed application. Unexpected exception: HRESULT 0x800700b7 returned at c:\b\w\da744fbcc13abce\src\servers\iis\aspnetcoremodulev2\inprocessrequesthandler\inprocessapplication.cpp:198

There are a couple of threads on GitHub concerning this error and hresult, but no resolutions.

The same code works on a local IIS. myapp.exe also loads (as does dotnet myapp.dll), so it seems to be an IIS configuration issue (or .NET Core defect as indicated on GitHub which implies that I may be seeking a work-around). A stdout file is created, but it doesn't have any contents.

This project is part of a solution with non-core projects. However, I published the project using Visual Studio web publisher and it runs as expected.

One Stack Overflow question recommended changing to OutOfProcess as the hosting model, but I do not want to use out of process. It also fails to load with the same hresult. It may be the case that .NET 2.2.3 is broken in a major way. But since I can run it locally, there exists a configuration which works.

This is the web.config file for the application:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <location path="." inheritInChildApplications="false">
    <system.webServer>
      <handlers>
        <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
      </handlers>
      <aspNetCore processPath=".\my.name.space.HealthMonitor.Mvc.exe" arguments="exec &quot;.\my.anme.space.HealthMonitor.Mvc.dll&quot;" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="InProcess">
        <environmentVariables>
          <environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" />
        </environmentVariables>
      </aspNetCore>
      </system.webServer>
  </location>
    <system.web>
        <compilation targetFramework="netcoreapp2.2" />
    </system.web>
</configuration>

I expect the page to load as it does in IIS Express or IIS local in which the default out-of-the-box page is displayed.

Best Answer

I had the same issue, and I found that running dotnet YourAPI.dll in Azure App Service. Go to:

App ServiceAdvanced ToolsGo (it will take you to Kudu) → Debug consolePowerShell;

Then navigate to site/wwwroot and now run:

dotnet YourAPI.dll

The result showed me a detailed error message.

Related Topic