About Aspire
Last modified on Thu 09 Oct 2025

.NET Aspire is a new, opinionated application model for building, running, and managing distributed .NET applications. It is designed to make cloud-native development approachable, productive, and reliable—whether building microservices, APIs, background workers, or multi-service solutions.

Aspire provides a set of tools, templates, and patterns that support:

Aspire is ideal for:

Key Features

How Does Aspire Work?

Creating a new Aspire solution typically generates two main projects:

AppHost Project

The AppHost project is the entry point and orchestrator for an Aspire solution. It defines which services and resources (such as databases, APIs, background workers, and caches) are part of the distributed application, and how they are connected. AppHost is responsible for:

The AppHost project typically contains an AppHost.cs file where the Aspire builder API is used to compose the application. This centralizes orchestration logic and simplifies management and evolution of the distributed solution.

For example, in the following AppHost.cs file, the code creates a local PostgreSQL database container resource and an API service that references it. Aspire automatically manages the connection string and service wiring, simplifying connection of services to their dependencies:

var builder = DistributedApplication.CreateBuilder(args);

// Register a PostgreSQL container
var postgres = builder.AddPostgresContainer("db");

// Register an API project and connect it to the database
builder.AddProject<Projects.ApiService>("apiservice")
    .WithReference(postgres)
    .WaitFor(postgres);

builder.Build().Run();

ServiceDefaults Project

The ServiceDefaults project is a shared library commonly used in Aspire-based solutions to centralize and standardize configuration, middleware, and service registration across multiple microservices or API projects. Referencing ServiceDefaults from each service ensures consistent application of best practices such as logging, health checks, OpenTelemetry, and other cross-cutting concerns.

Typical Uses

This approach reduces code duplication and enforces uniformity across the distributed application, simplifying maintenance and development.

A typical ServiceDefaults project exposes extension methods to apply common configuration to services. For example:

public static class ServiceDefaultsExtensions
{
    public static TBuilder AddServiceDefaults<TBuilder>(this TBuilder builder) 
            where TBuilder : IHostApplicationBuilder
    {
        builder.ConfigureOpenTelemetry();

        builder.AddDefaultHealthChecks();

        builder.Services.AddServiceDiscovery();

        builder.Services.ConfigureHttpClientDefaults(http =>
        {
            http.AddStandardResilienceHandler();
            http.AddServiceDiscovery();
        });

        return builder;
    }

        public static WebApplication MapDefaultEndpoints(this WebApplication app)
    {
        if (app.Environment.IsDevelopment())
        {
            app.MapHealthChecks(HealthEndpointPath);

            app.MapHealthChecks(AlivenessEndpointPath, new HealthCheckOptions
            {
                Predicate = r => r.Tags.Contains("live")
            });
        }

        return app;
    }
}

These extensions can then be invoked in each service's Program.cs:

var builder = WebApplication.CreateBuilder(args);
builder.AddServiceDefaults();

var app = builder.Build();
app.MapDefaultEndpoints();

This ensures all services share the same configuration, middleware, and observability setup.

Aspire Dashboard

The Aspire Dashboard is a web-based UI that provides a real-time, interactive visualization of the entire distributed application, including all running services, dependencies, health, logs, traces, metrics, and configuration. It is launched automatically when the Aspire solution runs locally. It facilitates issue detection, dependency monitoring, and understanding of service interactions. Each service view exposes environment variables and other diagnostics to support rapid diagnosis and optimization. The dashboard is especially valuable during local development and testing, offering deep insight into overall system health and behavior.

It shows:

Aspire Dashboard Overview Dashboard overview showing running services and their health.

Service Details Detailed view of a service's metrics.

Limitations and Pitfalls to Avoid

Limitations / Potential Disadvantages

Common Pitfalls to Avoid

Learn More