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.
A distributed application consists of several specialist components separated by network connections.
Structure of a modular monolith, in which different functionalities are managed inside the same application but split into distinct modules
An orchestrator coordinates separate services over the network in a distributed application and ensures that they act as one functioning system.
An Aspire host makes separate application services and infrastructure components run as though they're part of a single monolithic application.
The structure of the Aspire solution
Aspire dashboard
Aspire console log
Aspire Resources webfrontend link
Blazor app hosted in Aspire
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.
Building Distributed Applications that Work ebook for free