IWebHostBuilder

Looking at our Program.cs file, you can see that's exactly what happens: the Main() method only builds our web host, and starts it running with no terminating condition:

public class Program{    public static void Main(string[] args)    {        CreateWebHostBuilder(args).Build().Run();    }    public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>        WebHost.CreateDefaultBuilder(args)            .UseStartup<Startup>();}

The WebHost class is part of the Microsoft.AspNetCore namespace, and its default implementation provides a running Kestrel web server that interacts with your application code using the Startup.cs file provided to the UseStartup<T>() method on the IWebHostBuilder instance you return to your Main() method to be run by your program. ...

Get Hands-On Network Programming with C# and .NET Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.