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

不打扰是莪最后的温柔 提交于 2019-12-06 06:36:32

问题


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.

I've been looking into this for 3 days now and everything I have tried does not fix it.

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>

回答1:


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. More details are here




回答2:


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




回答3:


In my case updating .net core sdk works fine.




回答4:


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>



回答5:


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




回答6:


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

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



来源:https://stackoverflow.com/questions/55939860/how-to-fix-error-ancm-in-process-handler-load-failure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!