I have just migrated my ASP.NET Core version 2.2 to ASP.NET Core version 3.1. I have configured the web site to run under IIS In-Process mode. The application runs locally hosted with IIS Express.
During final testing, I deployed to a test site hosted on our IIS version 10 web server. As before, the site ran as expected. Today, I deployed the same build to the production web site, running on the same IIS server and constantly receive the following error:
HTTP Error 500.30 - ANCM In-Process Start Failure
My first thought was that there must be a difference in the Application Pool configuration between the two web sites, or perhaps a permissions difference between the two application pool identities, but visual inspection shows that both sites have the same configuration - the only difference that I can see is that the web site bindings are to two different URLs.
I then wondered if there was a difference between the two file installations, so I manually deleted the contents of the production site and copied the files from the staging site. This made no difference and the ANCM In-Process Start Failure remains.
I could see nothing unusual in the IIS logs, but if I look in the Windows event logs I see an error stating:
Unable to access appsettings.json in C:\Windows\System32
I can't find any references to this error on-line, but it seems that dor some reason it is not referencing the installing folder of C:\WWW\Reporting
but defaulting to the server's Windows folder. I suspect this is the clue, but I do not know where to look to fix it.
If I update the web-config
file and change the hosting model to 'OutOfProcess' the site runs correctly.
Two exact copies of the same ASP.NET Core version 3.1 web site, installed in directories next to each other, on the same web server using the same IIS instance, one site runs correctly, the other site errors with the ANCM In-Process Start Failure
HTTP error.
From the Windows Event logs, the site appears to be trying to start from the C:\Windows\System32
folder rather than its installed IIS web folder.
Reporting.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<NeutralLanguage>en-GB</NeutralLanguage>
</PropertyGroup>
</Project>
Program.cs
var config = ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json", false, true)
.AddJsonFile($"appsettings.{env}.json", true)
.Build();
var webHost = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIIS()
.UseStartup<Startup>()
.UseConfiguration(configuration);
webHost.Build().Run();
<?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="dotnet"
arguments=".\Reporting.dll"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
The Windows Event log is reporting the following error:
Application '/LM/W3SVC/106/ROOT' with physical root 'C:\www\Reporting\' hit unexpected managed exception, exception code = '0xe0434352'. First 30KB characters of captured stdout and stderr logs:
Unhandled exception. System.IO.FileNotFoundException: The configuration file 'appsettings.json' was not found and is not optional. The physical path is 'c:\windows\system32\inetsrv\appsettings.json'.
This looks odd, as I was expecting the application to load the appsettings.json
file from the root of the application ('C:\www\Reporting')
In the end, as is so often the case, the solution was simple, but I had missed it in the deployments docs.
In my case at least, the 2.2 version, running out-of-process
only required Read permissions to the installed directly. With the 3.1 version, running in-process
, the application permissions simply needed increasing to Read and Execute.
I hope that helps someone else who has missed this configuration change.
User contributions licensed under CC BY-SA 3.0