As we just saw, the new routing implementation is basically handled by the two services.AddMvc() and app.UseMvc() methods called within the Startup.cs file, which perform the following tasks respectively:
- Registering MVC using the Dependency Injection framework built into ASP.NET Core
- Adding the required middleware to the HTTP request pipeline, while also (optionally) setting a pack of default routes
We can take a look at what happens under the hood by looking at the current implementation of the app.UseMvc() method in the framework code (relevant lines are highlighted):
public static IApplicationBuilder UseMvc( [NotNull] this IApplicationBuilder app, [NotNull] Action<IRouteBuilder> configureRoutes) { // ...