The routing system of ASP.NET Core maps an incoming request to a route handler. In ASP.NET Core, the Startup class is responsible for configuring the routes that are needed by the application. Furthermore, the routing functionalities of ASP.NET Core are implemented using a middleware approach. Let's take a closer look at the Startup class and how it initializes the routing system:
public class Startup
{
...
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
...
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
The preceding code uses two extension methods: UseRouting and UseEndpoints. These methods were introduced in the latest release of ASP.NET Core. In the previous version of the framework, the routing system was initialized...