Overview

1 Getting started with distributed systems and Aspire

Running a distributed application is much harder than running a single app because its parts are split across independent services, data stores, caches, brokers, and background workers that must all cooperate. The chapter uses an online shop to show how a simple storefront and catalog API already form a distributed system, and how that system grows into a larger workflow with persistent storage, messaging, authentication, observability, and other supporting infrastructure.

The main challenge is that local development becomes messy when each component must be started separately, configured correctly, and made ready in the right order. Developers also have to manage changing addresses, environment-specific settings, network failures, partial outages, and debugging across multiple logs and terminals, while integration tests must recreate the full topology to prove the whole system actually works.

Aspire is presented as the solution to these problems through development-time orchestration. Using a central host application, AppHost, it models the system in code, starts resources together, passes configuration, waits for dependencies, enables service discovery, and exposes health and telemetry in a shared dashboard. Service defaults provide reusable setup for health checks, telemetry, and discovery, allowing the UI to call the API without hardcoded addresses while keeping each service independently deployable.

A shopper’s request crosses the storefront, API, data stores, and background-processing components. Telemetry makes the complete workflow observable.
figure
A distributed application consists of several specialist components separated by network connections.
figure
Structure of a modular monolith, in which different functionalities are managed inside the same application but split into distinct modules
figure
An orchestrator coordinates separate services over the network in a distributed application and ensures that they act as one functioning system.
figure
An Aspire host makes separate application services and infrastructure components run as though they're part of a single monolithic application.
figure
The structure of the Aspire solution
figure
Aspire dashboard
figure
Aspire console log
figure
Aspire Resources webfrontend link
figure
Blazor app hosted in Aspire
figure

Summary

  • Microsoft created Aspire to simplify the process of developing distributed applications.
  • Distributed applications are systems that consist of multiple independent services that interact with one another.
  • Orchestration is the process of coordinating services inside a distributed system.
  • The main benefit of using Aspire is that it lets you run and debug a distributed application from a single place on a development machine, which substantially simplifies development.
  • Aspire consists of the Aspire Host project, to which all other projects can connect.
  • Different applications hosted by Aspire can pass references to one another when they’re registered by the orchestrator.
  • The service defaults project is used for shared dependencies that any Aspire-hosted apps can use.
  • Service discovery lets you resolve addresses of Aspire-hosted apps by the names under which they were registered in the orchestrator.
  • The Aspire orchestrator displays a dashboard that shows the status of all running services.

FAQ

What is a distributed application?A distributed application is a system made up of multiple independently running components that work together over a network to deliver one overall user experience.
Why are distributed applications harder to run locally than monolithic applications?They usually require multiple services, databases, caches, and brokers to start in the right order, with correct configuration and network addresses. That makes local setup, debugging, and testing much more complex than running a single executable.
What problem does Aspire solve for .NET developers?Aspire helps developers model, run, debug, and observe distributed applications from one place. It reduces the pain of coordinating services, infrastructure, configuration, readiness, and telemetry during development.
What is the AppHost in Aspire?The AppHost is the central project that describes the distributed application in code. It registers resources, defines relationships between them, and acts as the orchestrator that starts and coordinates the system.
What can Aspire do with the application model defined in AppHost?It can start resources together, supply configuration and connection information, coordinate dependencies, enable service discovery, and show resource state and telemetry in a shared dashboard.
Why is service discovery important in Aspire?Service discovery lets services find one another without hardcoded addresses. This makes the application easier to move between environments and reduces fragile configuration tied to ports, hostnames, or container mappings.
What is the purpose of service defaults in an Aspire solution?Service defaults provide shared extension methods used by the applications in the solution. They typically enable service discovery, health checks, OpenTelemetry, and other common startup features.
Why does the web application use WithExternalHttpEndpoints()?It makes the web app’s endpoints accessible outside Aspire’s internal network, so users can reach the frontend from a browser. The API service usually stays internal and is accessed only by other services.
Why does the frontend use WaitFor(apiService)?It ensures the frontend starts only after the API is ready. This prevents the UI from failing because it tries to call a dependency that is still starting or not yet available.
How does Aspire help diagnose failures in a distributed system?Aspire provides a shared dashboard with service state, logs, and links to endpoints. Combined with telemetry such as metrics and traces, it helps developers see which component failed and how a request moved through the system.

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


Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 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
  • Building Distributed Applications that Work Building Distributed Applications that Work ebook for free
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 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
  • Building Distributed Applications that Work Building Distributed Applications that Work ebook for free
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 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
  • Building Distributed Applications that Work Building Distributed Applications that Work ebook for free