Get Started with Aspire at Its Best: Version 17

Β· 9 min read

You know that moment when you just want to run the application, but first you need to start a database, find the right connection string, launch Redis, remember which port the API uses, and open three terminals?

By the time everything is running, you’ve forgotten what you wanted to work on. πŸŽ„

This post is my contribution to the 2026 Technology Advent Calendar: AI & Agents, Data & Power BI, and SQL, a community initiative bringing together three parallel calendars. We’re going to unwrap Aspire 17 by building a small distributed application, then look at what the new release brings to the developer experience.

The goal is not to memorize every API. It’s to understand the idea: describe your application and its relationships once, then use that model to run, inspect, and eventually publish it.

What is Aspire, anyway?

Aspire is a developer platform for building distributed applications. It doesn’t replace ASP.NET Core, Redis, PostgreSQL, Docker, or Kubernetes. It helps you describe how the pieces fit together and gives you tools to work with them.

The AppHost is the composition root. It describes resources: projects, containers, databases, and the relationships between them. The dashboard gives you a place to inspect those resources and the telemetry your applications emit. Integrations help configure both the resources and the clients that use them.

Here’s the little system we’re going to build:

                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚   Web frontend  β”‚
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚ HTTP
                           β–Ό
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                  β”‚   API service   β”‚
                  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
                         β”‚    β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    └──────────┐
              β–Ό                          β–Ό
       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
       β”‚ PostgreSQL β”‚             β”‚   Redis    β”‚
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

       AppHost: defines and connects the resources
       Dashboard: helps us see what's happening

The diagram shows application relationships, not a network security policy. The frontend doesn’t talk to the database or cache directly; the API does.

Start with a blank folder

You’ll need the Aspire CLI, a compatible .NET SDK, and a container runtime such as Docker Desktop running locally. The starter uses ASP.NET Core and Blazor; Aspire can also orchestrate applications written in other languages.

Create a starter app and choose the C# / .NET option if prompted:

aspire new aspire-starter --name AdventApp --output ./AdventApp --version 17.0.0
cd AdventApp
aspire run

The starter gives us an AppHost, an API, a web frontend, and a ServiceDefaults project. Open the dashboard URL printed by the CLI and try the web app. Stop the AppHost before making the following changes.

Starting from an empty directory doesn’t mean writing all the boilerplate by hand. The starter is a useful baseline: it already includes service discovery and telemetry configuration.

Add a database and a cache

From the AppHost directory, add the hosting integrations:

cd AdventApp.AppHost
aspire add Aspire.Hosting.PostgreSQL --version 17.0.0
aspire add Aspire.Hosting.Redis --version 17.0.0

Now open the AppHost’s AppHost.cs and update its resource declarations. Keep the existing builder creation and builder.Build().Run(); the resource definitions in between can look like this:

var postgres = builder.AddPostgres("postgres");
var catalog = postgres.AddDatabase("catalog");
var cache = builder.AddRedis("cache");

var apiService = builder.AddDotnetProject(
        "apiservice", "../AdventApp.ApiService/AdventApp.ApiService.csproj")
    .WithHttpHealthCheck("/health")
    .WithReference(catalog)
    .WaitFor(catalog)
    .WithReference(cache)
    .WaitFor(cache);

builder.AddDotnetProject(
        "webfrontend", "../AdventApp.Web/AdventApp.Web.csproj")
    .WithExternalHttpEndpoints()
    .WithHttpHealthCheck("/health")
    .WithReference(apiService)
    .WaitFor(apiService);

Read this from the bottom up: the web frontend needs the API; the API needs the catalog database and cache. Aspire can start the backing containers locally and provide their connection information to the API.

Two methods deserve a closer look:

  • WithReference(...) passes connection information or service discovery configuration to the consumer. It doesn’t write database queries or install client libraries in your application.
  • WaitFor(...) expresses a startup dependency. It waits for the dependency to be ready according to its resource state and health checks; it is not a substitute for handling failures or reconnections after startup.

Names matter: catalog and cache are the names the API will use to find its configuration. The database and cache here are local development resources; no persistent volumes are configured, so don’t treat their data as durable.

Make the API actually use them

The AppHost describes the infrastructure. The API still needs clients. Go back to the solution directory and add the client integrations:

cd ..
dotnet add AdventApp.ApiService package Aspire.Npgsql --version 17.0.0
dotnet add AdventApp.ApiService package Aspire.StackExchange.Redis.DistributedCaching --version 17.0.0

In the API’s Program.cs, add these registrations after WebApplication.CreateBuilder(args) and before builder.Build():

builder.AddNpgsqlDataSource("catalog");
builder.AddRedisDistributedCache("cache");

Add these imports at the top:

using Microsoft.Extensions.Caching.Distributed;
using Npgsql;

Finally, add this endpoint before app.Run(), leaving the starter’s existing endpoints in place:

app.MapGet("/dependency-demo", async (
    NpgsqlDataSource database,
    IDistributedCache cache,
    CancellationToken cancellationToken) =>
{
    const string key = "database-time";
    var cached = await cache.GetStringAsync(key, cancellationToken);

    if (cached is not null)
    {
        return Results.Ok(new { source = "redis", value = cached });
    }

    await using var command = database.CreateCommand("SELECT now()::text");
    var value = (string)(await command.ExecuteScalarAsync(cancellationToken))!;

    await cache.SetStringAsync(
        key,
        value,
        new DistributedCacheEntryOptions
        {
            AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(30)
        },
        cancellationToken);

    return Results.Ok(new { source = "postgres", value });
});

This isn’t a production caching strategy. It’s a tiny experiment: on a cache miss, query PostgreSQL and store the result for 30 seconds; on a hit, return the cached value. If either dependency fails, the request fails rather than silently pretending everything is fine.

Run aspire run again, open the API endpoint shown in the dashboard, and append /dependency-demo to its base URL. Call it twice within 30 seconds. The first response should report postgres; the second should report redis. After the entry expires, the next request should query PostgreSQL again.

Meanwhile, the starter frontend still calls the API’s original weather endpoint. Our new endpoint exercises the two dependencies separately, so we can see the resource wiring without rewriting the frontend.

The dashboard puts resources first

Aspire 17 redesigns the dashboard around the resources that make up your application. Instead of asking β€œwhich log window did I leave that in?”, start with the thing you’re investigating.

Try this:

  1. Find webfrontend, apiservice, PostgreSQL, and Redis in the resource table. Inspect their state, health, and endpoints.
  2. Open the API’s console logs, make requests to /dependency-demo, and inspect the structured logs and traces available for the application.
  3. Use search, filters, grouping, and pinned metric cards to focus on the resources you care about.
  4. Explore the dedicated Terminals page for resources that expose interactive terminals.

Telemetry isn’t magic: a trace only contains operations for which instrumentation and export are configured. The starter’s Service Defaults and the client integrations give you a useful starting point, but don’t assume every SQL or Redis operation will automatically appear as a span.

Want the current topology as a diagram? With the AppHost running, use another terminal:

aspire describe --format Mermaid > resources.mmd

That’s a snapshot in Mermaid syntax that you can paste into a compatible Markdown renderer. The dashboard can export the resource graph too. The diagram above is deliberately plain text so it remains readable on this blog even without a Mermaid renderer.

The CLI grows up for teams

aspire new, aspire add, and aspire run are only the beginning. Version 17 adds shell completions, environment-specific secrets, and ways for teams to offer their own templates, integration feeds, and agent skills alongside the built-in sources.

aspire doctor
aspire describe
aspire secret list --environment Development
aspire completions script pwsh

Use the completions script for your shell according to the CLI documentation. Secrets are stored separately per environment in your user profile, outside the project. That’s convenient for local development; it is not a replacement for a production secrets manager. Avoid putting secret values in source code or shell history.

Team configuration sources are opt-in defaults, not enforced policy. Trust matters: templates and agent plugins can contain executable code. See the Aspire 17 release notes for configuration examples.

Go AppHosts: the new kid at the table 🐹

An AppHost doesn’t have to be written in C#. Aspire 17 introduces Go AppHosts in preview. This refers to the language used to define the application, not just the ability to run a Go service.

To try the Go starter in a separate directory:

aspire new aspire-go-starter --name go-advent --output ./go-advent
cd go-advent
aspire run

The starter creates a Go AppHost, Go API, and Vite/React frontend; Redis is optional. You’ll need Go 1.26 or later as well as the Aspire CLI. Go AppHosts are not generally available yet, so check the Go AppHost guide before making them a production dependency.

Same resource model, different language. That’s an exciting direction for teams whose architecture doesn’t fit inside a single ecosystem.

Let an agent help investigate

Aspire 17 also improves the connection between the Aspire VS Code extension and coding agents. An agent can use language-model tools to inspect the editor’s AppHosts, check debugging status, explain a recent launch failure, and open the dashboard or Aspire output. It can also request attachment of a debugger to a running .NET or Go resource.

For example, with the Aspire extension installed and the app running, try asking your agent:

β€œWhy didn’t my API start? Check the Aspire launch failure and open the relevant output.”

Or:

β€œAttach the debugger to the running API resource.”

The debugging tool requires Aspire extension 1.25.0 or later; the other new editor-assistance tools require 1.24.0 or later. Appropriate language debugging extensions are still needed. Review what the agent does and keep sensitive logs and credentials out of prompts and shared context.

This is developer tooling for working with an agent, not a claim that adding Aspire automatically turns your application into an AI agent.

From local development to Kubernetes

The Kubernetes deployment packages are stable in Aspire 17. That is a significant milestone: you can use the application model to generate deployment artifacts without maintaining a completely separate description of every relationship.

For example, add the Kubernetes hosting integration to the AppHost:

cd AdventApp.AppHost
aspire add Aspire.Hosting.Kubernetes --version 17.0.0

Then add a Kubernetes environment to the AppHost before builder.Build().Run():

builder.AddKubernetesEnvironment("k8s");

And generate deployment artifacts:

aspire publish -o k8s-artifacts

Publish is not deploy. Inspect the generated artifacts before using them with your cluster’s deployment process. A real deployment also needs a cluster, a suitable container registry and image access, configuration and secrets, and decisions about networking, persistent storage, and the database and cache lifecycle. Local containers are not automatically production-ready managed services.

For registry setup, Helm options, persistent volumes, and cluster-specific configuration, follow the Kubernetes deployment guide. Stable packages mean the deployment APIs have graduated; they don’t remove the need to review and operate the resulting infrastructure.

One model, fewer surprises

What I like about this approach is the feedback loop: express the architecture in code, run it locally, inspect the resources, and iterate. The resource model gives the team a shared starting point; it doesn’t eliminate the hard work of application design or production operations.

Aspire 17 makes that loop more interesting: a resource-first dashboard, a CLI that works better for teams, agent-assisted debugging, a preview of Go AppHosts, and a stable Kubernetes deployment path.

If you’re new to Aspire, start small. Run the starter, add one dependency, break it on purpose, and use the dashboard to find out why. Then add the next piece. That’s much more useful than trying to learn every integration in one sitting.

Happy Advent, and happy building! πŸŽ„

Further reading