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

后端 未结 16 2810
攒了一身酷
攒了一身酷 2020-12-13 17:39

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 th

相关标签:
16条回答
  • 2020-12-13 18:05

    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

    0 讨论(0)
  • 2020-12-13 18:06

    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>
    
    0 讨论(0)
  • 2020-12-13 18:07

    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.

    0 讨论(0)
  • 2020-12-13 18:10

    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.

    0 讨论(0)
  • 2020-12-13 18:12

    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.

    0 讨论(0)
  • 2020-12-13 18:13

    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

    0 讨论(0)
提交回复
热议问题