Setting up Kestrel
As we did in the first two chapters of this book, we need to override the default WebHostBuilder type a little bit to set up Kestrel. With ASP.NET Core 3.0 and higher, it is possible to replace the default Kestrel base configuration with a custom configuration. This means that the Kestrel web server is configured to the host builder:
- You will be able to add and configure Kestrel manually simply by using it. The following code shows what happens when you call the
UseKestrel()method onIwebHostBuilder. Let's now see how this fits into theCreateWebHostBuildermethod:public class Program { public static void Main(string[] args) { CreateWebHostBuilder(args).Build().Run(); } public static IHostBuilder CreateHostBuilder(string[] args) => ...