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 => ...