liveBook · Manning

Aspirification

As explained in Building Distributed Applications that Work

Aspirification is the process of enrolling existing applications in Aspire orchestration.

Aspirification is the process of enrolling existing applications in Aspire orchestration. An aspirified system keeps its application projects while adding an Aspire host to describe how they run together. For example, a hosted Blazor frontend can call a backend API that still reaches SQL Server through its existing connection string. section 10.2 section 10.6

Enroll an existing .NET solution incrementally:

  • Add an Aspire host and, usually, a Service Defaults project. Use an IDE to add them manually, or run `aspire init` in the solution folder and follow its setup prompts. section 10.2
  • Reference the existing projects from the host, then add them to `AppHost.cs`. Give the frontend a reference to the API and make it wait for the API when starting. section 10.2
  • Reference Service Defaults from each participating service and call `builder.AddServiceDefaults()` during startup. Map default endpoints with `app.MapDefaultEndpoints()`; a host can use `/health` as an HTTP health check. section 10.2

Service Defaults is optional if the system already has its own metrics and health-check mechanisms, but it provides service discovery, telemetry, and health-check capabilities. Aspirification also need not move an external database into Aspire: existing connection strings can remain in place so the applications continue to use their production resources. section 10.2 section 10.6

Listing 10.5 Adding project references to the Aspire host
var builder = DistributedApplication.CreateBuilder(args);

var apiService = builder.AddProject<Projects.OnlineShop_ApiService>("apiservice")
    .WaitFor
    .WithReference;

builder
    .AddProject<Projects.OnlineShop_Web>("webfrontend")
    .WithExternalHttpEndpoints()
    .WithReference(apiService)
    .WaitFor(apiService);

builder.Build().Run();

The AppHost listing shows the existing API and frontend registered as projects, with the frontend referencing and waiting for the API. section 10.2

How Building Distributed Applications that Work covers it

How deep it goes
Walks through adding a host, project references, Service Defaults, and startup calls; leaves an existing database connection string intact.
Examples
Uses a hosted Blazor frontend, backend API, and externally hosted SQL Server database, plus an AppHost project-registration listing.
What it assumes
Assumes an existing .NET solution with application projects; introduces the Aspire host and Service Defaults as additions.
What you can do after
Apply it via the Aspire CLI or an IDE to enroll existing projects and configure their orchestration and shared defaults.
How it connects
Connects Aspire orchestration with service discovery, telemetry, health checks, project references, and existing connection strings.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Distributed Applications that Work. The section links point to the parts of the book it draws on.