# ASP.NET Core Minimal APIs vs MVC Controller Routing: Key Differences Explained

> Explore ASP.NET Core Minimal APIs vs MVC controller routing. Understand the key differences in endpoint models, attribute routing, and framework features to choose the best approach for your application.

- Repository: [.NET Platform/aspnetcore](https://github.com/dotnet/aspnetcore)
- Tags: comparison
- Published: 2026-06-20

---

**Minimal APIs expose a lightweight, function-based endpoint model via `MapGet` and `MapPost` calls, while MVC controllers provide a full-featured framework with attribute routing, model binding, and filter pipelines.**

ASP.NET Core offers two distinct approaches for building HTTP endpoints that share the same underlying routing infrastructure but differ significantly in architecture and capabilities. Understanding the difference between ASP.NET Core Minimal APIs and MVC controller routing is essential for choosing the right pattern for your application. This article examines the implementation details in the `dotnet/aspnetcore` repository to explain how each approach handles route registration, model binding, and request processing.

## Defining Endpoints: Inline Registration vs Attribute Routing

### Minimal API Route Registration

In Minimal APIs, you define routes directly in [`Program.cs`](https://github.com/dotnet/aspnetcore/blob/main/Program.cs) (or any file building the `WebApplication`) using extension methods like `MapGet`, `MapPost`, `MapPut`, and `MapDelete`. These methods register a single endpoint with a specific route pattern and HTTP method, creating a direct mapping between the URL and the request delegate.

### MVC Controller Route Declaration

MVC controllers use **attribute routing** on classes inheriting from `ControllerBase`. The `[Route]`, `[HttpGet]`, and `[HttpPost]` attributes decorate controller classes and action methods, establishing URL patterns through metadata rather than inline registration code.

## Routing Architecture and Pipeline Execution

Both approaches utilize the **endpoint routing** subsystem, but they differ significantly in how endpoints are constructed before reaching the routing middleware.

According to the `dotnet/aspnetcore` source code, Minimal APIs create endpoints directly when you call `app.MapGet("/customers/{id}", ...)`. The framework registers a single endpoint with the route pattern and request delegate, storing it in the `EndpointDataSource` without intermediate abstractions or convention layers.

MVC controllers, however, build an **application model** at startup. The framework inspects types deriving from `ControllerBase` in [`src/Mvc/Mvc.Core/src/ControllerBase.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Mvc/Mvc.Core/src/ControllerBase.cs), discovers action methods, and applies conventions and filters before converting them into endpoints. This additional layer enables complex scenarios like action filters and result transformation that Minimal APIs cannot perform.

The `EndpointRoutingMiddleware` in [`src/Routing/src/EndpointRoutingMiddleware.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Routing/src/EndpointRoutingMiddleware.cs) matches incoming requests to endpoints for both approaches, but MVC requires additional middleware to execute its filter pipeline after the endpoint is matched.

## Model Binding and Validation Comparison

### Minimal API Parameter Binding

Minimal APIs rely on **implicit parameter binding** where method parameters automatically map to route values, query strings, or request bodies. Validation is opt-in via the Validation endpoint filter (`builder.Services.AddValidation()`), which you apply using `AddEndpointFilter` on specific routes.

### MVC Model Binding System

MVC provides a comprehensive model-binding system through `IModelBinder` implementations that support complex type mapping, `[FromBody]`, `[FromQuery]`, and other binding attributes. Data annotation validation runs automatically, populating `ModelState` that you can check via `ModelState.IsValid` inside your action methods in `ControllerBase`.

## Filters and Extensibility

### Minimal API Endpoint Filters

Minimal APIs support **endpoint filters** only, added via `AddEndpointFilter` on specific mapped routes. This limited pipeline keeps overhead low but restricts cross-cutting concerns to explicit per-endpoint registration.

### MVC Filter Pipeline

MVC controllers offer a rich filter ecosystem including action filters, result filters, exception filters, and authorization filters. These execute in a defined order around your action method, enabling reusable behaviors like logging, caching, and transaction management across multiple controllers.

## Code Examples

The following example from [`src/Http/samples/MinimalValidationSample/Program.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Http/samples/MinimalValidationSample/Program.cs) demonstrates Minimal API route registration with validation:

```csharp
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddValidation();          // Enable validation endpoint filter
var app = builder.Build();

// Simple GET with route parameter binding
app.MapGet("/customers/{id}", ([Range(1, int.MaxValue)] int id) =>
    $"Getting customer with ID: {id}");

// POST with model binding and automatic validation
app.MapPost("/customers", (Customer customer) =>
    TypedResults.Created($"/customers/{customer.Name}", customer));

```

This example from [`src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherForecastController.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherForecastController.cs) shows MVC controller patterns:

```csharp
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
    // GET /WeatherForecast
    [HttpGet]
    public IEnumerable<WeatherForecast> Get()
    {
        return Enumerable.Range(1, 5).Select(index => new WeatherForecast
        {
            Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
            TemperatureC = Random.Shared.Next(-20, 55),
            Summary = Summaries[Random.Shared.Next(Summaries.Length)]
        })
        .ToArray();
    }
}

```

## Key Source Files in the ASP.NET Core Repository

- **Minimal API validation sample**: [`src/Http/samples/MinimalValidationSample/Program.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Http/samples/MinimalValidationSample/Program.cs) demonstrates how `MapGet` and `MapPost` register endpoints with validation filters.
- **MVC controller template**: [`src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherForecastController.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Controllers/WeatherForecastController.cs) shows attribute routing patterns and `ControllerBase` inheritance.
- **Controller base class**: [`src/Mvc/Mvc.Core/src/ControllerBase.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Mvc/Mvc.Core/src/ControllerBase.cs) provides the `ModelState` property and action result helpers used by MVC controllers.
- **Routing middleware**: [`src/Routing/src/EndpointRoutingMiddleware.cs`](https://github.com/dotnet/aspnetcore/blob/main/src/Routing/src/EndpointRoutingMiddleware.cs) handles request matching against the `EndpointDataSource` for both Minimal APIs and MVC.

## Summary

- **Minimal APIs** register routes directly via `MapGet`, `MapPost`, and other extension methods on `WebApplication`, creating lean endpoints without the overhead of a controller class.
- **MVC controllers** use attribute routing on classes inheriting from `ControllerBase`, building an application model that supports conventions, complex model binding, and filter pipelines.
- Both approaches ultimately use the same **endpoint routing** infrastructure in `EndpointRoutingMiddleware`, but MVC adds middleware layers for filters and model binding.
- Choose **Minimal APIs** for microservices, prototypes, and simple HTTP endpoints where low overhead matters.
- Choose **MVC controllers** for complex applications requiring extensive validation, content negotiation, API versioning, and reusable filter logic.

## Frequently Asked Questions

### Can Minimal APIs and MVC controllers coexist in the same ASP.NET Core application?

Yes. You can register Minimal API endpoints in [`Program.cs`](https://github.com/dotnet/aspnetcore/blob/main/Program.cs) while also calling `services.AddControllers()` and `app.MapControllers()` to enable both patterns within the same application. The `EndpointRoutingMiddleware` matches requests to the appropriate endpoint regardless of which approach defined it.

### Why do MVC controllers have more overhead than Minimal APIs?

MVC controllers construct an **application model** at startup, applying conventions and instantiating filter chains for each action. This architecture, defined in `ControllerBase` and related classes, provides flexibility but requires additional memory and processing compared to the direct request delegates used by Minimal APIs.

### How do I add validation to Minimal API endpoints?

Add the validation service via `builder.Services.AddValidation()` and apply the validation filter to specific endpoints using `AddEndpointFilter`. Alternatively, use data annotations on parameters or manually validate inside the route handler, as the automatic `ModelState` validation found in MVC is not present by default in Minimal APIs.

### When should I choose Minimal APIs over MVC controllers?

Select Minimal APIs when building small-footprint services, serverless functions, or microservices where you want minimal ceremony and maximum performance. Choose MVC controllers when your application requires view rendering, complex API versioning, extensive filter pipelines, or when you need the automatic model validation and binding behaviors provided by the `ControllerBase` class.