After updating a .NET Core 2.2 app to NET 5, the following error appeared:

System.InvalidOperationException: ‘Application is running inside IIS process but is not configured to use IIS server.’


To fix this use HotBuilder instead of WebHostBuilder


public class Program


    private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Program));


    public static void Main(string[] args)





    public static IHostBuilder CreateHostBuilder(string[] args) =>


            .ConfigureWebHostDefaults(webBuilder =>



                .UseKestrel(serverOptions => serverOptions.AddServerHeader = false)






Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.