ASP.NET Core application initially starts as a console application
- It consists of Main method in its Program class which is the entry point
- Program class is located inside the root directory of the project

Main Method
- Main method configures ASP.NET Core
- The Main method invokes WebHost.CreateDefaultBuilder, to create a web host
public class Program { public static void Main(string[] args) { CreateWebHostBuilder(args).Build().Run(); } public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) .UseStartup<Startup>(); }
- IWebHostBuilder, the return type of the WebHost.CreateDefaultBuilder has methods that define a web server and the startup class
- The web server extension methods such as UseKestrel() for Kestrel server, UseIIS() for IIS server, UseHttpSys() for HTTPSys server, can be used
- Kestrel web server is default server used by framework
- Kestrel is a cross-platform web server for ASP.NET Core
- It is the default web server included by ASP.NET Core project templates
- The UseStartup method specifies the Startup class for your application
- The Startup class is where any services required by the app are configured and the request handling pipeline is defined.
No comments:
Post a Comment