ASP.NET Core MVC is the .NET Core counterpart of the ASP.NET MVC framework. You can take advantage of ASP.NET Core MVC to build cross-platform, scalable, high-performance web applications and APIs using the Model-View-Controller design pattern. ASP.NET Core takes advantage of routing to map incoming requests to respective controller actions.
You can learn the basics of routing in ASP.NET Core from my earlier article, “.” This article presents a discussion of how we can use endpoint routing in ASP.NET Core 3.0 MVC.
Endpoint routing is a feature newly introduced in ASP.NET Core that enables you to provide routing information to middleware in the request processing pipeline. Before the introduction of endpoint routing, routing resolution in ASP.NET Core MVC was performed at the end of the request processing pipeline. As a result, route information (such as which action method needs to be executed) was unknown to any middleware processing a request before the MVC middleware in the request processing pipeline. Incidentally, endpoint routing is available as part of ASP.NET 3.0 and later versions.
Endpoint routing matches HTTP requests to endpoints early in the middleware pipeline instead of at the end. This allows middleware later in the pipeline to access the resolved endpoint and apply additional processing. In other words, endpoint routing decouples the route matching and endpoint dispatching functions, giving you the flexibility to combine different middleware (MVC, CORS, Razor Pages, Blazor, etc.) in your applications.
To work with the code examples provided in this article, you should have Visual Studio 2019 installed in your system. If you don’t have a copy of it, you can .