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 RunsCharacteristics 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.


Join the conversation! Your thoughts help the community grow.