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:

Code
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:

Code
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

Code
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:

Code
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

Code
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

FeatureOld Pipeline (.NET 5)New Pipeline (.NET 6+)
Startup FileProgram.cs + Startup.csOnly Program.cs
Hosting ModelGeneric Host + WebHostUnified Minimal Host
Code StructureSplit across two filesSingle unified file
BoilerplateHighVery low
Minimal APIsNot supportedFully supported
CustomizationRequires HostBuilder patternMore flexible
ReadabilityMore formal, longerVery clean, modern
Best forLarge enterprise appsMicroservices, 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:

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