Setting up WebHostBuilder
As in the last chapter, we will focus on Program.cs
in this section. WebHostBuilder
is our friend. This is where we configure and create the web host.
The following code snippet is the default configuration of every new ASP.NET Core web we create using File | New | Project in Visual Studio, or running the dotnet new
command with the .NET CLI:
public class Program { Â Â Â Â public static void Main(string[] args) Â Â Â Â { Â Â Â Â Â Â Â Â CreateHostBuilder(args).Build().Run(); Â Â Â Â } Â Â Â Â public static IWebHostBuilder CreateHostBuilder( Â Â Â Â Â Â Â Â string[] args) => Â Â Â Â Â Â Â Â Host.CreateDefaultBuilder(args) Â Â Â Â Â Â Â Â Â Â Â Â .ConfigureWebHostDefaults(webBuilder => Â Â Â Â Â Â Â Â Â Â ...