The ASP.NET Core request pipeline has evolved significantly since .NET 5 and earlier.
With .NET 6+, Microsoft introduced the Minimal Hosting Model, which changed how the web application pipeline is built, configured, and executed.
This article explains:
How the old pipeline worked
How the new pipeline works
Key differences
Why Microsoft changed it
Which model is better for modern applications
1️⃣ What Is the ASP.NET Core Pipeline?
The ASP.NET Core pipeline consists of middlewares that process every incoming HTTP request.
Each request flows through middleware components such as:
Routing
Authentication
Authorization
CORS
Exception Handling
MVC / Endpoints
The hosting model defines how this pipeline is built and executed.
2️⃣ OLD PIPELINE (.NET 2.0 – .NET 5)
The Startup + Program Model
Before .NET 6, the pipeline was created using two files:
1. Program.cs
Created the Host Builder:
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
2. Startup.cs
Defined Services + Middleware:
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
📌 Old Pipeline Diagram
Program.cs
↓
CreateHostBuilder()
↓
ConfigureWebHostDefaults()
↓
Startup.cs loaded
↓
- ConfigureServices()
- Configure()
↓
Application Pipeline Prepared
↓
App Runs
Characteristics of the Old Model
✔ More structured
✔ Clearly separated responsibilities
✔ More verbose
✔ Required a lot of boilerplate
✔ Harder for beginners
3️⃣ NEW PIPELINE (.NET 6+)
The Minimal Hosting Model
.NET 6 unified everything into a single file: Program.cs
Example:
var builder = WebApplication.CreateBuilder(args);
// Services
builder.Services.AddControllers();
var app = builder.Build();
// Middleware
app.UseAuthorization();
app.MapControllers();
app.Run();
No Startup.cs, no CreateHostBuilder, no UseStartup.
📌 New Pipeline Diagram
Program.cs
↓
WebApplication.CreateBuilder()
↓
builder.Services (DI configured)
↓
builder.Build()
↓
app (middleware pipeline configured)
↓
app.Run()
Characteristics of the New Model
✔ Much simpler
✔ Minimal boilerplate
✔ Services + middleware in one place
✔ Supports Minimal APIs
✔ Easier for microservices and cloud apps
✔ Feels like Node.js, Express, and modern frameworks
4️⃣ Side-by-Side Comparison
| Feature | Old Pipeline (.NET 5) | New Pipeline (.NET 6+) |
|---|
| Startup File | Program.cs + Startup.cs | Only Program.cs |
| Hosting Model | Generic Host + WebHost | Unified Minimal Host |
| Code Structure | Split across two files | Single unified file |
| Boilerplate | High | Very low |
| Minimal APIs | Not supported | Fully supported |
| Customization | Requires HostBuilder pattern | More flexible |
| Readability | More formal, longer | Very clean, modern |
| Best for | Large enterprise apps | Microservices, APIs, modular apps |
5️⃣ Why Did Microsoft Change the Pipeline?
1. Reduce complexity
No more multiple classes and builders.
2. Make .NET beginner-friendly
Single-file startup is easier for newcomers.
3. Support Minimal APIs
A more lightweight host was required.
4. Modernize .NET
Matches frameworks like Express, Flask, Go Fiber.
5. Align Web, Worker, and Console apps
Everything now follows the same hosting pattern.
6️⃣ Is the Old Pipeline Still Supported?
✔ Yes, you can still use Startup.cs if you want:
builder.Host.UseStartup<Startup>();
✔ .NET 6+ remains fully backward compatible.
But the Minimal Hosting Model is the recommended approach.
7️⃣ Which Model Should You Use?
Use the New Model (Recommended) If:
You're building microservices
You're using Minimal APIs
You want clean, modern code
You prefer a single startup file
You're deploying to Kubernetes or cloud
Use the Old Model If:
You are working in a large legacy app
Your team prefers strict separation
You want Startup.cs for organizational reasons
8️⃣ Final Summary
With .NET 6+, Microsoft introduced a clean, modern, unified hosting model that merges Program.cs and Startup.cs into one file.
This new pipeline:
simplifies startup
supports minimal APIs
reduces boilerplate
matches modern frameworks
improves code readability
makes .NET more cloud-ready and microservice-friendly
The old model is still supported, but the new pipeline is the future of ASP.NET Core development.