Setting up Kestrel
After WebHostBuilder
is created, we can use various functions to configure the builder. Here we already see one of them, which specifies the startup class that should be used.
Note
As discussed in Chapter 4, Configuring and Customizing HTTPS with Kestrel, Kestrel is one possibility when it comes to hosting your application. Kestrel is a web server built in .NET and based on .NET socket implementations. Previously, it was built on top of libuv
, which is the same web server that is used by Node.js. Microsoft removed the dependency on libuv
and created their own web server implementation based on .NET Sockets.
In the last chapter, we saw the UseKestrel
method to configure the Kestrel options:
.UseKestrel((host, options) => { // ... })
This first argument is a WebHostBuilderContext
type to access already configured host settings or the configuration itself. The second argument is an object to configure Kestrel. This code snippet...