Overview

1 Getting Started with .NET Aspire

.NET Aspire arrived unexpectedly alongside .NET 8 and C# 12 in late 2023 and quickly gained traction because it directly addresses a long-standing pain: developing and debugging distributed applications locally with ease. By orchestrating multiple services in a unified experience and aligning local development with production-like behavior, it removes much of the friction that previously required ad hoc scripts and partial setups. This chapter introduces the problem space, outlines the fundamentals of distributed systems and orchestration, and frames how Aspire streamlines building, running, and deploying multi-service applications.

Distributed applications consist of autonomous services communicating over lightweight protocols and offer benefits such as scalability, agility, technology diversity, and fault isolation, but they also introduce operational and testing complexity, network concerns, and security considerations. Orchestration coordinates deployment, scaling, health, configuration, and resource allocation so the whole system operates reliably. Aspire builds on these foundations as a cloud-native stack with preconfigured components, a declarative application model for wiring services and dependencies, seamless integration with infrastructure like databases and message brokers, and built-in observability using OpenTelemetry. The result is a simpler path from local development to the cloud and a significant boost in developer productivity.

Practically, the chapter walks through the Aspire Starter Project, which includes a Blazor UI, an API service, an AppHost orchestrator, and a ServiceDefaults library for shared cross-cutting concerns. Running the AppHost presents a dashboard with service states, endpoints, and logs, while the host registers services by logical names, controls exposure of external endpoints, and uses service discovery so the UI calls the API by name rather than hardcoded addresses; startup ordering and dependencies are declared fluently to ensure readiness. ServiceDefaults centralizes health checks, telemetry, resilient HTTP, and discovery via simple extension methods invoked in each app, setting a solid baseline the following chapters build upon with deeper monitoring and orchestration capabilities.

Example of a distributed application
Modular monolith structure
Orchestrated system
Hosting code and infrastructure components in the same Aspire process
The structure of the Aspire solution
Aspire dashboard
Aspire console log
Aspire Resources webfrontend link
Blazor app hosted in Aspire

Summary

  • .NET Aspire was created by Microsoft to make the process of developing distributed applications easy.
  • Distributed applications are systems that consist of multiple independent services that interact with each other.
  • Orchestration is the process of coordinating services inside a distributed system
  • The main benefit of using .NET Aspire is that it allows running and debugging a distributed application in a single process on a development machine, which substantially simplifies the development process
  • .NET Aspire consists of the Aspire Host project that all other projects can connect to
  • Different applications hosted by .NET Aspire can pass each other’s references to each other when they are registered by the orchestrator
  • The Service Defaults project is used for shared dependencies that any Aspire-hosted apps can use
  • Service discovery allows to resolve addresses of Aspire-hosted apps via the names the apps were registered under in the orchestrator
  • Aspire orchestrator displays a dashboard, which shows the status of all running services

FAQ

What is .NET Aspire?.NET Aspire is a cloud-native application stack for building, running, and monitoring distributed applications in .NET. It provides an orchestrated “AppHost” that starts and coordinates your services, integrates infrastructure (like databases and message brokers), and offers a unified developer experience with dashboards and observability.
Why did .NET Aspire have such an impact on the .NET community?It solved a long-standing pain: developing and debugging distributed applications locally. Aspire lets you launch an entire multi-service system in one orchestrated run, debug services together, and keep local behavior closer to production—similar to how Docker brought consistency across environments.
What does orchestration mean in the context of distributed systems?Orchestration manages and coordinates services so they work together. Typical responsibilities include: - Deployment and updates - Auto-scaling - Load balancing - Health monitoring and self-healing - Configuration and secret management - Resource allocation (CPU, memory, storage)
What projects come with the Aspire Starter Project template?The template creates: - AspireApp.Web: a Blazor UI that calls an API - AspireApp.ApiService: a REST API used by the UI - AspireApp.AppHost: the Aspire orchestrator host - AspireApp.ServiceDefaults: a class library of shared extension methods (service discovery, health checks, telemetry, etc.)
How do I register services in the Aspire host (AppHost)?Use DistributedApplication.CreateBuilder to build the host, then register projects with AddProject<Projects.ProjectName>("serviceName"). For web apps exposed externally, call WithExternalHttpEndpoints(). Use WaitFor(apiService) to ensure startup order and WithReference(apiService) to enable service discovery between services.
What are “Service Defaults” and why are they important?Service Defaults are shared extension methods (in AspireApp.ServiceDefaults) that standardize: - Service discovery registration - Health checks and default endpoints - OpenTelemetry logging/metrics/tracing and exporters - HttpClient configuration and resilience You enable them in each app with builder.AddServiceDefaults() and app.MapDefaultEndpoints().
How does service discovery work in .NET Aspire?Install Microsoft.Extensions.ServiceDiscovery and enable it in Service Defaults (AddServiceDiscovery and http.AddServiceDiscovery). Clients then target services by name—e.g., using a base address like “https+http://apiservice”. Aspire resolves the actual address and handles HTTPS/HTTP fallback based on the scheme.
What information does the Aspire dashboard provide?The dashboard lists each service’s type, unique name, run state, source project, endpoints, logs, and details. You can: - Open console logs to verify health and diagnose issues - Click endpoint URLs to navigate to running services (e.g., the Blazor UI)
How does Aspire support observability out of the box?Aspire integrates OpenTelemetry for logs, metrics, and tracing with ASP.NET Core and HttpClient instrumentation. It can export telemetry via OTLP when OTEL_EXPORTER_OTLP_ENDPOINT is configured, enabling rich monitoring and troubleshooting with minimal setup.
What are the pros and cons of distributed systems, and how does Aspire help?Pros: - Independent scaling, agility, technology diversity - Fault isolation and resilience - Easier team scaling and CI/CD Cons: - Operational and testing complexity - Network latency/failures, security surface area - Higher initial design effort Aspire reduces development and deployment friction through orchestration, service discovery, health checks, and integrated observability.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$399.99
only $33.33 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • .NET Aspire Made Easy ebook for free
choose your plan

team

monthly
annual
$49.99
$399.99
only $33.33 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • .NET Aspire Made Easy ebook for free