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

后端 未结 16 2909
攒了一身酷
攒了一身酷 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: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();
        return builder;
    }
    

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

    
        Staging
    
    

提交回复
热议问题