How to fix error "ANCM In-Process Handler Load Failure"?

37

I'm setting up the first site in IIS on Windows Server 2016 Standard. This is a NET Core 2.2 application. I cannot get the site to show.

I am getting this error:

HTTP Error 500.0 - ANCM In-Process Handler Load Failure

What can I change to clear this error and get my site to display?

My application is a dll.

I tested my application on the server through the Command Prompt with

dotnet ./MyApp.dll

it displays in the browser but only on the server itself with (localhost:5001/).

Using this method the site cannot be accessed from any other server. When I set up the site through IIS, I get the In-Process error both on the server and from servers attempting to access the site.

At first I was receiving the Out-Process error. Something I read said to add this (hostingModel="inprocess") to my web.config so I did but now I receive the In-Process error.

The site works fine when installed on my development server.

The Event Viewer shows this error for "IIS AspNetCore Module V2":

Failed to start application '/LM/W3SVC/2/ROOT', ErrorCode '0x8000ffff'.

This is my web.config:

<?xml version="1.0" encoding="utf-8"?>
    <configuration>
  <system.web>
    <customErrors mode="RemoteOnly"></customErrors>
        <identity impersonate="false" password="****" userName="****" />
  </system.web>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\MyApp.dll" stdoutLogEnabled="false" hostingModel="inprocess" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false">
      <environmentVariables />
    </aspNetCore>
  </system.webServer>
</configuration>
iis
asp.net-core
asp.net-core-2.2
asked on Stack Overflow May 1, 2019 by Mark • edited Jul 25, 2020 by Dale K

16 Answers

57

I had the same issue in .Net core 2.2. When I replace

web.config:

<handlers>
    <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>

to

<handlers>
    <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>

then it works fine.

Note: The same solution also works for .Net core 2.2 and other upper versions as well.

answered on Stack Overflow Sep 27, 2019 by Arif • edited Sep 21, 2020 by Arif
9

Open the .csproj file and under Project > PropertyGroup > AspNetCoreHostingModel, change the value “InProcess” to “OutOfProcess”.

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>

answered on Stack Overflow Dec 3, 2019 by Alamgir
4

For more info, in web.config, set

stdoutLogEnabled="true"

then check the logs folder. In my case it had nothing to do with project, publishing or hosting settings - it was my fault for not copying a file essential to my app. The error was simply "Could not find file "D:\Development\IIS Hosting Test\filename.ext"

answered on Stack Overflow Dec 8, 2019 by Alex Cooper • edited Dec 8, 2019 by Alex Cooper
4

Sometimes this is because multiple applications may be using same Application Pool

In such cases first application will work and other won't work

Solution is to create new application pool for each application.

answered on Stack Overflow Feb 18, 2020 by codemirror
4

I had the same error.

According to Microsoft(https://dotnet.microsoft.com/download/dotnet-core/current/runtime), We should install the 'ASP.NET Core Hosting Bundle' in our hosting server.

'The ASP.NET Core Hosting Bundle includes the .NET Core runtime and ASP.NET Core runtime. If installed on a machine with IIS it will also add the ASP.NET Core IIS Module'

After I did, The 'AspNetCoreModuleV2' installed on my server and everything works well. It didn't need to change your 'web.config' file.

answered on Stack Overflow Apr 14, 2020 by user2760293 • edited Apr 14, 2020 by user2760293
1

For my particular issue it was the site permissions in IIS.

I edited the permissions to "Everyone" and it worked. I got the information from this page: https://github.com/aspnet/AspNetCore/issues/6111

answered on Stack Overflow May 2, 2019 by Mark
1

In my case updating .net core sdk works fine.

0

I fixed this here Asp.Net Core Fails To Load - you need to specify that the program uses an in process or out of process model.

I changed my CreateWebHostBuilder to:

public static IWebHostBuilder CreateWebHostBuilder(string[] args) 
{
    var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT");
    var builder = WebHost.CreateDefaultBuilder(args);

    if (env == EnvironmentName.Staging || env == EnvironmentName.Production)
        builder.UseIIS();

    builder.UseStartup<Startup>();
    return builder;
}

PS. I set ASPNETCORE_ENVIRONMENT in my .pubxml deployment profile by adding:

<PropertyGroup>
    <EnvironmentName>Staging</EnvironmentName>
</PropertyGroup>
answered on Stack Overflow Oct 23, 2019 by Liam • edited Jan 17, 2020 by Tieson T.
0

You can get this if you try to access the site using a IIS url but Visual Studio is setup to use IISExpress

See also ASP.Net Core 1.0 RC2 : What are LAUNCHER_PATH and LAUNCHER_ARGS mentioned in web.config?

Long story short, the web.config is changed by Visual Studio when you switch between IIS and IISExpress. If you use an IIS url when it's setup to use IISExpress then the aspNetCore processPath will be wrong

Also, it's not uncommon to copy web.config files. You could get the same error if you don't change the processPath

answered on Stack Overflow Nov 8, 2019 by tony • edited Nov 8, 2019 by tony
0

For me it was because I had ASPNETCORE_ENVIRONMENT environment variable being defined 2 times in my app - one in web.config and another - in applicationhost.config

answered on Stack Overflow Apr 10, 2020 by Konstantin Vasilev
0

In my case just adding MVC into Startup.cs Please follow into image. I am trying to add dependency injection then showing this problem. I think it will be helpful. Follow this Image: https://i.stack.imgur.com/ykw8P.png

0

Delete the 'hosting Model ="in process"' section in web config.

Example:

<aspNetCore processPath="dotnet" arguments=".\WebAPICore.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />

to

<aspNetCore processPath="dotnet" arguments=".\WebAPICore.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
answered on Stack Overflow May 12, 2020 by miragessee
0

I'm also getting "HTTP Error 500.0 - ANCM In-Process Handler Load Failure"

Except in my case...Everything was running great until I got the Blue Screen of Death.

I have a solution with two startup projects.
One is an API (that comes up) and the other is a WebApp(which gets the error). Both are .NET Core 3.1..also VS2019.

First I tried setting a break point in Main() of program.cs...it never got this far.

 public static void Main(string[] args)
 {
     CreateHostBuilder(args).Build().Run();
 }

On a hunch...I Looked at the NuGet packages installed. I uninstalled and (re)installed

Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation(3.1.6)

...and now its working again.

answered on Stack Overflow Jul 31, 2020 by Chris Catignani
0

In case anyone else cannot find a solution to this here was my scenario:
I recently started a new project using .NET 5, and everything was working. Then I upgraded from Preview 5 to 7 and all of a sudden my IIS Express would no longer work. The fix for me was to simply repair Visual Studio:

VS 2019 Repair.

answered on Stack Overflow Aug 4, 2020 by Spencer Krug • edited Aug 5, 2020 by de.
0

I belive that IISExpress got messed up along the way.

Try the following:

'Clean Solution' from VS
Got to the solution folder and delete the .vs folder from there.
Build and run.

answered on Stack Overflow Sep 18, 2020 by chapas
-4

Change platform target to Any CPU.

Change platform target to Any CPU

answered on Stack Overflow Dec 16, 2019 by Majid gharaei • edited Dec 16, 2019 by Shree

User contributions licensed under CC BY-SA 3.0