Equivalent of UseUrls for .NET Core 3.1/IHostBuilder

The method ConfigureWebHostDefaults allows you to configure the web host. One of the thing you can do is change the urls: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/host/generic-host?view=aspnetcore-3.1#urls

    public static IHostBuilder CreateHostBuilder(string[] args) =>
        Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseStartup<Startup>();
                webBuilder.UseUrls("http://localhost:5100");
            });

Leave a Comment