ASP.NET Core MVC is the ASP.NET Core implementation of the Model-View-Controller pattern. It provides a framework for building web applications with controllers that contain action methods, while Razor Pages builds on the same framework underneath. section 13.0 section 13.4
Use ASP.NET Core MVC to:
- Build server-rendered applications with MVC controllers and Razor views. section 19.1 section 19.0
- Create API endpoints with controllers that return JSON or XML. section 19.1
- Let routing select an endpoint before endpoint middleware executes it. section 13.4
One controller framework, different responses
An MVC controller can generate HTML for a server-rendered page or JSON/XML for an API response. ASP.NET Core combines these capabilities in one MVC framework, although applications commonly dedicate individual controllers to one response style. section 19.1
Figure 13.8 The middleware pipeline for a typical ASP.NET Core application. The request is processed by middleware in sequence. If the request reaches the routing middleware, the middleware selects an endpoint, such as a Razor Page, to execute. The endpoint middleware executes the selected endpoint.
Follow the request through middleware: routing selects an endpoint, and endpoint middleware executes the selected Razor Page or other endpoint. section 13.4
