📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

What is Aspire (formerly .NET Aspire), and what problem does it solve for a team building several services on .NET 10? Explain the AppHost, what happens when you press F5 or run `aspire run`, and what Aspire is not.

What Aspire is, the local distributed-development problem it solves, the AppHost and the developer inner loop, the dashboard, and the limits of what Aspire does.

Beginner Theory Beginner apphost cloud-native dotnet-aspire local-development opentelemetry orchestration

🎯 Key points

  • Aspire is an opinionated stack for building, running and deploying distributed apps; the '.NET' prefix was dropped at Aspire 13 (November 2025, alongside .NET 10) as it became multi-language
  • It solves the inner-loop pain: starting several services, databases and caches together, wiring ports and connection strings, and seeing telemetry across them
  • The AppHost is a C# project whose Program.cs models the app as resources (projects, containers, executables) and the references between them
  • Running the AppHost starts every resource, injects connection strings and endpoints as environment variables, and opens the dashboard
  • The dashboard shows resources, console logs, structured logs, traces and metrics locally over OTLP, so one request can be followed across services
  • Service defaults add OpenTelemetry, health checks, service discovery and resilience to each service in one call
  • Aspire is not a production runtime: production runs on Container Apps, Kubernetes or App Service; Aspire generates and can deploy the artefacts (aspire publish / aspire deploy / azd)
  • It usually takes over local orchestration from Compose scripts but can coexist with them; trade-off is a great inner loop versus one more layer to learn and keep updated

⏱ 30-second answer

Aspire (called .NET Aspire until version 13 in November 2025) is Microsoft's opinionated stack for building, running and deploying distributed applications. The centre is the AppHost: a C# project where Program.cs describes your app as resources (projects, containers such as SQL Server and Redis, executables) and the references between them.

When you run the AppHost (F5 or aspire run), Aspire starts every resource, injects connection strings and endpoints as environment variables, and opens the dashboard with logs, traces and metrics from every service.

  • It usually takes over the job of Compose files, scripts and README steps for local runs, though it can sit alongside them.
  • Service defaults give every service OpenTelemetry, health checks, service discovery and resilience.

It is not a production runtime: production runs on Container Apps, Kubernetes or App Service, and Aspire generates (and can drive) the deployment. The trade-off is a great inner loop versus one more layer to learn.

🗣 Full answer (senior)

How I would answer this in an interview

"Aspire, which was called .NET Aspire until version 13, is an opinionated stack for building and running distributed .NET applications. The problem it solves is the inner loop. As soon as a system has an API, a worker, a front end, SQL Server, Redis and a message broker, getting it running on a laptop means Docker Compose files, scripts, hard-coded ports and a README that is always out of date. Aspire gives you an AppHost instead: a C# project where I model the app as resources, such as AddProject, AddSqlServer and AddRedis, and say which ones reference which.

When I run the AppHost, Aspire's orchestrator starts every resource, pulls and runs the containers, allocates ports, and injects the connection strings and service endpoints into each project as environment variables, so builder.Configuration.GetConnectionString("orders") just works. It also opens the dashboard, which receives OpenTelemetry from every service, so I can follow one request from the API through the worker to SQL Server and see where the time went. A shared service defaults project adds OpenTelemetry, health checks, service discovery and HTTP resilience to every service in one line.

The mistake I see is treating Aspire as a production platform. It isn't: in production the app runs on Azure Container Apps, AKS or App Service, and Aspire's role there is to generate the deployment artefacts from the same model and, if you want, run the deployment. Aspire makes the system you run locally look like the system you deploy, which is where most of its value comes from."


The pieces

Piece What it is Why it matters
AppHost A C# project (Aspire.AppHost.Sdk) that models resources and references The single source of truth for what the app is made of
Resources Projects, containers, executables, cloud resources, parameters Started and wired by the orchestrator
Service defaults A shared project with AddServiceDefaults() Consistent telemetry, health checks, discovery and resilience
Integrations NuGet packages for SQL Server, Redis, PostgreSQL, Service Bus and more Hosting side (run the resource) and client side (connect to it)
Dashboard Web UI for resources, logs, traces and metrics Local observability with no extra setup
CLI and deployment aspire run, aspire publish, aspire deploy, or azd Turns the same model into Bicep, Compose or Kubernetes output

What the telemetry buys you

Signal What you see locally What it catches before production
Traces One waterfall per request across API, worker, Redis and SQL spans N+1 calls between services, missing caching, slow queries, broken context propagation
Structured logs Logs from every service, filterable and linked to the trace id Errors in a downstream service you'd otherwise never open
Metrics Request rate, latency histograms, GC and thread-pool counters Allocation spikes and thread-pool starvation under a quick load test

Because the same OpenTelemetry set-up is exported to Application Insights or a Collector in production, the instrumentation you check locally is the instrumentation you'll rely on during an incident.

Before and after Aspire

Task Without Aspire With Aspire
Start the system Compose up, then run three projects in the right order Run the AppHost
Connection strings Copied into user secrets on every machine Injected from the model
Service URLs Hard-coded localhost:5123 https+http://catalog via service discovery
Telemetry locally Usually none Dashboard with traces across services
New joiner set-up Half a day Clone, install Docker and the SDK, run

When it fits and when it does not

Fits Doesn't fit
Two or more services plus backing resources A single API with one database (still useful, but less so)
Teams that want the same telemetry set-up everywhere Teams whose platform team already gives them a full local environment
Greenfield .NET 10 work on Azure Systems where local runs aren't possible (e.g. mainframe dependencies)

Production example

A team with [an API, two workers, SQL Server, Redis and Service Bus] took [about four hours] to onboard a developer, mostly fixing ports and connection strings. After moving the local set-up to an AppHost, a new joiner ran the whole system in [under 15 minutes], and the dashboard's traces exposed an N+1 call between the API and the pricing service that nobody had seen locally before.

🔍 What the interviewer is checking

Checks that the candidate knows what Aspire actually does, the AppHost model, and that it is a development-time tool rather than a production runtime.

Green flags

  • Explains the AppHost, resources and references, and environment variable injection.
  • Mentions the dashboard and service defaults.
  • Says clearly that production runs elsewhere and Aspire generates deployment artefacts.
  • Knows about the rename at Aspire 13 and the .NET 10 requirement.

Red flags

  • Thinks Aspire is a hosting platform or replaces Kubernetes.
  • Can only describe it as "a template".
  • Has never heard of the AppHost.

📚 Learn in depth

1. The problem: distributed inner loop

A microservice or modular system multiplies local set-up work. Every service needs its dependencies running, the right ports and the right configuration, and you can't easily see what happens across service boundaries.

Without Aspire:
  docker compose up (sql, redis)  ->  dotnet run api  ->  dotnet run worker  ->  npm run web
  + appsettings.Development.json in each repo with localhost ports
  + no shared telemetry

With Aspire:
  aspire run (or F5 on the AppHost)
     |
     +-- DCP orchestrator starts: sql (container), redis (container), api, worker, web
     +-- injects env vars: ConnectionStrings__orders, services__api__https__0, OTEL_*
     +-- dashboard on https://localhost:<port> receives OTLP from everything

2. The application model

The AppHost builds a graph of resources. Each resource has a name, endpoints, environment variables and annotations. WithReference(x) adds an edge: "this resource needs x", which becomes environment variables in the consumer. WaitFor(x) delays start until x is healthy. Nothing about this is magic: it is a DSL over environment variables and process/container start-up.

3. Who runs things locally

The AppHost hands the model to the Developer Control Plane (DCP), a Kubernetes-style orchestrator that runs on your machine. DCP launches .NET projects as processes and containers through Docker or Podman, and watches them. That is why Docker (or Podman) is a prerequisite.

4. Telemetry by default

Each service calls AddServiceDefaults(), which configures OpenTelemetry logging, tracing and metrics with an OTLP exporter. The AppHost sets OTEL_EXPORTER_OTLP_ENDPOINT to the dashboard, so traces show up with no code beyond that call.

5. From local to deployment

The same model is used to generate deployment output. aspire publish writes artefacts (Bicep for Azure Container Apps, Docker Compose files, or Kubernetes/Helm output, depending on the environment you add), and aspire deploy or azd up provisions and deploys them. Production runs on that platform, not on Aspire.

6. Versions and naming (as of November 2026)

  • Aspire 8 and 9 were ".NET Aspire". Aspire 13 (November 2025) dropped the prefix, needs the .NET 10 SDK, and added first-class Python and JavaScript resources. The 13.x line has continued with minor releases (TypeScript AppHosts reached general availability in 13.4).
  • The CLI (aspire new, aspire run, aspire add, aspire publish, aspire deploy) is now the main entry point, alongside Visual Studio and VS Code.

Try it yourself

  1. Install the Aspire CLI and run aspire new aspire-starter; run it and open the dashboard.
  2. Add Redis with aspire add redis, reference it from the API, and find the injected ConnectionStrings__cache on the resource's details page.
  3. Stop the Redis container from Docker Desktop and watch the API's health and traces change in the dashboard.
  4. Run aspire publish and read the generated output to see how the model becomes deployment artefacts.

💻 Code

A minimal AppHost: one API, one worker, SQL Server and Redis, with references and start-up ordering.

// AppHost/Program.cs
var builder = DistributedApplication.CreateBuilder(args);

// Backing resources run as containers locally.
var sql = builder.AddSqlServer("sql")
                 .WithDataVolume();          // keep data between runs
var ordersDb = sql.AddDatabase("orders");
var cache = builder.AddRedis("cache");

// Projects: references become env vars (connection strings, endpoints).
var api = builder.AddProject<Projects.Orders_Api>("api")
                 .WithReference(ordersDb).WaitFor(ordersDb)
                 .WithReference(cache);

builder.AddProject<Projects.Orders_Worker>("worker")
       .WithReference(ordersDb).WaitFor(ordersDb)
       .WithReference(api);                  // enables http://api via service discovery

builder.Build().Run();
// Orders.Api/Program.cs: the service just reads normal configuration.
var builder = WebApplication.CreateBuilder(args);
builder.AddServiceDefaults();                              // OTel, health, discovery, resilience
builder.AddSqlServerDbContext<OrdersDbContext>("orders");   // client integration reads ConnectionStrings:orders
builder.AddRedisDistributedCache("cache");

var app = builder.Build();
app.MapDefaultEndpoints();                                  // /health and /alive (Development by default)
app.MapGet("/orders/{id:int}", async (int id, OrdersDbContext db, CancellationToken ct) =>
    await db.Orders.FindAsync([id], ct) is { } o ? Results.Ok(o) : Results.NotFound());
app.Run();

⚠ Common mistakes

  • Mistake: Calling Aspire a production orchestrator. Why it is wrong: The local orchestrator (DCP) only runs on developer machines and in CI; production runs on Container Apps, AKS or App Service. Instead: Describe Aspire as a dev-time model plus a generator (and optional driver) of deployments.
  • Mistake: Thinking Aspire requires microservices. Why it is wrong: It is useful for any app with backing resources, even one API with SQL Server and Redis. Instead: Use it when it removes local set-up pain, whatever the architecture.
  • Mistake: Forgetting Docker or Podman is required. Why it is wrong: Container resources such as SQL Server and Redis need a container runtime, so the AppHost fails to start them. Instead: Document the prerequisite and check it in onboarding.
  • Mistake: Hard-coding connection strings in the service even after adding the AppHost. Why it is wrong: They override the injected values and break when ports change. Instead: Read them by name with GetConnectionString("orders") or a client integration, validate required settings at start-up with ValidateOnStart, and keep real secrets in user secrets locally and Key Vault when deployed.
  • Mistake: Skipping AddServiceDefaults() in a new service. Why it is wrong: That service sends no telemetry and has no health endpoints, so it is invisible on the dashboard and in production monitoring. Instead: Reference the service defaults project from every service, and check for it in code review.
  • Mistake: Describing Aspire with out-of-date facts (".NET Aspire 9 on .NET 8"). Why it is wrong: It suggests you haven't used it recently; Aspire 13 renamed it and needs the .NET 10 SDK. Instead: Talk about the current 13.x line and what it added (multi-language resources, the aspire CLI, aspire deploy).

🏛 Senior insight: trade-offs

Aspire's real value is consistency: the same model drives local runs, tests and deployment, and every service gets the same telemetry and health set-up. I judge it by onboarding time and how quickly people can follow a request across services, not by how clever the AppHost is.

Option When it fits Cost When not to
Aspire AppHost .NET-heavy systems with several services and resources Learning the model; keeping packages current One small service with no dependencies
Docker Compose Polyglot teams, or production also uses Compose YAML drift; no telemetry by default When you want typed references and a dashboard
Scripts + README Throwaway prototypes Breaks silently as the system grows Anything a team maintains
Remote dev environments Systems too big for a laptop Cloud cost; network dependency Small systems

🔗 Follow-ups the interviewer may ask

  1. When: Candidate mentions the AppHost or resources Why: Checks hands-on AppHost knowledge beyond the definition
    How to answer

    The AppHost's Program.cs creates a DistributedApplication builder, adds resources, links them and runs:

    • AddProject<Projects.Orders_Api>("api") adds a project; the name becomes its service-discovery name.
    • AddSqlServer("sql").AddDatabase("orders") and AddRedis("cache") run containers locally; the resource name is the connection-string name.
    • WithReference(db) injects ConnectionStrings__orders; WithReference(api) injects services__api__https__0, the endpoint.
    • WaitFor(db) holds start-up until the database is healthy.

    Add WithDataVolume() to keep data, ContainerLifetime.Persistent to avoid restarting slow containers, and AddParameter(..., secret: true) for passwords. The trade-off: references are simple, but every name is a contract between the AppHost and the service's configuration.

  2. When: Candidate compares Aspire with Docker Compose Why: Checks they know the alternative and when Compose is the better fit
    How to answer

    Docker Compose describes a multi-container app in a compose.yaml: each service (the API, mcr.microsoft.com/mssql/server, redis) gets an image or build context, ports, environment variables and volumes. docker compose up starts them on a shared network where they find each other by service name, so the API connects to Server=sqlserver,1433.

    I add a health check to SQL Server and depends_on: condition: service_healthy to the API, because SQL Server takes several seconds to accept logins. A named volume keeps the data between runs.

    It is for local development and CI, not production. In a .NET-only solution, .NET Aspire does the same orchestration in C# with dashboards, and Testcontainers is better for integration tests.

  3. When: Candidate mentions traces in the dashboard Why: Checks the distributed tracing basics behind the dashboard
    How to answer

    Distributed tracing records the path of one request through every service it touches. A trace is the whole operation; a span is one timed piece of work inside it, such as an incoming HTTP request, a SQL query or a Service Bus send. Every span in a trace shares a trace id (16 bytes, written as 32 hex characters), has its own span id (8 bytes, 16 hex characters), and points to its parent span id, so the spans form a tree you can view as a waterfall.

    The ids travel between services in the W3C traceparent header, with optional vendor-specific data in tracestate. In .NET a span is a System.Diagnostics.Activity, and OpenTelemetry exports it.

    Logs alone tell you what happened in each service, but not which call caused which or where the 2 seconds went. Traces give you causality and timing; logs give you detail. The trade-off is volume: traces are expensive, so you sample them.

More in .NET Aspire

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me