Setting up Kestrel
After WebHostBuilder
is created, we can use various functions to configure the builder. Here, we can 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 into .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 to 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 WebHostBuilderContext
to access already-configured hosting settings or the configuration itself. The second argument is an object to configure Kestrel. This code snippet shows...