Endpoint routing was introduced in ASP.NET Core 2.2 and is now the default mechanism as of 3.0. The main advantage is that it supports many different mechanisms that, although leveraging routing and middleware, are very different—MVC, Razor Pages, gRPC, Blazor, SignalR, and whatnot. You still register the services you want in ConfigureServices and then add the middleware to the pipeline using extension methods in the Configure method. Endpoint routing makes the framework more flexible because it decouples route matching and resolution from endpoint dispatching, which used to be all part of the MVC functionality.
There are three required method calls:
- AddRouting: Where we register the required services and optionally configure some of its options (ConfigureServices)
- UseRouting: Where we actually add the routing middleware (Configure); this matches requests to an endpoint
- UseEndpoints: Where we configure the...