Starting with version 3.0, ASP.NET Core is now bootstrapped using a generic host. This means that it is not tied specifically to HTTP or any other web protocol, but it potentially supports any kind of protocol, including low-level TCP. The templates have changed and now the bootstrap looks something like this:
Host
.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
We are now using the Host class to create an instance of a class that implements IHostBuilder, not IWebHostBuilder, although the result is the same.
We can interfere in the bootstrap process by means of extension methods. Specifically, we can configure the following:
- Services registration
- Logging
- Configuration
- Web hosting defaults (host, startup class)
Here is a full example of changing the configuration:
Host
.CreateDefaultBuilder...