Application is running inside IIS process but is not configured to use IIS server .NET Core 3.0

前端 未结 3 875
小蘑菇
小蘑菇 2021-02-01 12:22

I have migrated our application from .NET Core 2.2 to version 3.0. Actually I created the new application in 3.0 from scratch and then copied source code files. Everything looks

相关标签:
3条回答
  • 2021-02-01 12:58

    In my case I ran wrong profile (IIS Express) in Visual Studio by carelessness.

    0 讨论(0)
  • 2021-02-01 13:03

    I also came across this issue while following the documentation https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.0&tabs=visual-studio

    For your case I have checked and the code below will work, with the call to webBuilder.UseKestrel() removed.

    public static IHostBuilder CreateHostBuilder(string[] args) =>
           Host.CreateDefaultBuilder(args)
               .ConfigureWebHostDefaults(webBuilder =>
               {
                   webBuilder.UseContentRoot(Directory.GetCurrentDirectory());
                   webBuilder.UseIISIntegration();
                   webBuilder.UseStartup<Startup>();
               });
    
    0 讨论(0)
  • 2021-02-01 13:04

    I had the same error then to fix my problem I needed to change webBuilder.UseKestrel(); to ConfigureKestrel(serverOptions => {})

    My Program.cs before:

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseKestrel();
                webBuilder.UseStartup<Startup>();
            });
    

    My Program.cs fixed:

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.ConfigureKestrel(serverOptions =>
                {
                })
                .UseStartup<Startup>();
            });
    
    0 讨论(0)
提交回复
热议问题