Conventional routing

In the conventional routing style, during application startup, you define route templates that will be queried each time an incoming request is received in order to make a URL matching. This process will eventually map to a controller and a method inside it. If no route is found for the incoming request, an HTTP error of 404 (Not Found) will be returned to the caller.

When you called AddMvc inside the ConfigureServices method and the UseMvcWithDefaultRoute  method inside the Configure method in your startup class, at the same time, behind the scenes, the MVC framework added a route handler and set the route to the default template, which looks like this:

"{controller=Home}/{action=Index}/{id?}"

This template defines that ...

Get Hands-On Full-Stack Web Development with ASP.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.