Blog

BackBack to Blogs

.Net Aspire


We used two lunches a week during the cold months of January and February to dig into Microsoft's Open Source .Net Aspire offering. The format was individual learning over lunch on Mondays. Then, during Thursday's lunch, we share what we have learned with the group. This followed the method we learned in the Learn Better book discussion – learn something new and then teach others or put it into practice to solidify the knowledge.

🍴Side note: For many years, we have used several lunches weekly to learn together and strengthen personal relationships. We find this to be essential to our culture.

Microsoft describes .NET Aspire as "a set of tools, templates, and packages for building observable, production-ready apps" that "improves the experience of building apps that have a variety of projects and resources. With dev-time productivity enhancements that emulate deployed scenarios, you can quickly develop interconnected apps."

We decided to investigate the orchestration features and how this tool could enhance our development experience. This was a great opportunity to learn about the best practices they have embedded and familiarize ourselves with the technologies.

Getting Started

It was easy to get started with a new project using their templates. You can fire one up if you have Visual Studio 2022 and .Net 8 or 9. You will need Docker Desktop or Podman Desktop to run once you add a container integration (such as Redis, SQL, Azure Resource, etc). They've also made it easy with the Visual Studio and VS Code tooling to orchestrate existing applications.

The introduction has a lengthy explanation with screenshots if you'd like to explore.

🏎️ Even at the end of February 2025, the Microsoft team is moving fast. They released a production-ready GA with .Net 9 at .Net Conf in November 2024, but after each preview release, they tell you the previous versions are not supported. Be prepared to update often, give feedback, and maybe hit some bumps in the road.

Best Practices

Service Discovery

We are thankful that .Net Aspire connected the web app, the API, and the other services. We won't miss having to find and then change URL ports or setting those in settings files

It's also great to have the pieces startup together and visible with metrics in the dashboard during development!

Resiliency – The HttpClient calls automatically retry and handle transient failures, thanks to an integration with the Polly project.

Observability – Open Telemetry is good; see more below.

Observability

The OpenTelemetry Protocol is "High-quality, ubiquitous, and portable telemetry to enable effective observability" with the goal of making it super easy to instrument applications and send to App Insights, Prometheus, Datadog, or another of your choice.

It's great that the .Net Aspire leads us into OpenTelemetry. We will use this observability approach for our applications, even if we don't use Aspire.

Containers

Containers are a great way to create applications that have multiple pieces. No more "it works on my machine," faster ramp up, and avoiding the need to install a lot of software on a developer machine. Aspire makes it much easier to connect these together and use best practices.

During our research, we found that Podman Desktop works as a good alternative to Docker Desktop, which is a licensing requirement for larger companies.

 Integrations

Microsoft and other companies have created a lot of integrations for .Net Aspire. In their own words, “.NET Aspire integrations are a curated suite of NuGet packages selected to facilitate the integration of cloud-native applications with prominent services and platforms, such as Redis and PostgreSQL. Each integration furnishes essential cloud-native functionalities through either automatic provisioning or standardized configuration patterns.” ~ https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/integrations-overview

The .Net Foundation has a community toolkit of integrations and extensions.

Web Applications

When it comes to web apps, Aspire not only streamlines backend and microservice orchestration but also offers a framework for integrating modern web applications. For example, when working with NPM-based frameworks such as Vue, React, or Angular, Aspire’s tooling can help you create a better full-stack experience. Here are some key features that Aspire can provide:

Integration with NPM Apps:

Leverage Aspire’s orchestration capabilities to run NPM applications alongside your .NET services. This integration allows you to manage front-end dependencies with NPM while coordinating start-up, configuration, and container orchestration in a single unified development workflow.

Unified Observability:

Benefit from Aspire’s observability features to monitor both backend and frontend services. Whether it’s tracking performance metrics, logging, or debugging, you can maintain a detailed view of your application’s health even when integrating a modern Vue frontend with your .NET services.

Concurrent Development & Hot Reloading:

With Aspire, you can configure your NPM application’s development server (via NPM scripts) to run concurrently with your .NET backends. This facilitates live reloading and real-time feedback, streamlining debugging and accelerating development cycles.

We’ve found that more manual changes are needed for NPM Apps than service apps, but we hope Microsoft continues to make that story easier and more straightforward. Here’s a recent blog post, .NET Aspirations - Tailor it to Your Stack, explaining one approach.

 Blazor

For those unfamiliar with Blazor, there are two distinct hosting models: Blazor Server and Blazor WebAssembly (WASM). The Aspire examples showcase Blazor Server integration, which fits naturally into Aspire's backend environment and works seamlessly.

Blazor WASM is another story. Since it runs client-side in the browser, it doesn’t naturally fit into Aspire’s orchestration model. While I was able to get it working, it required custom setup and didn’t provide any real advantages. Key Aspire features like OpenTelemetry and AddServiceDefaults rely on backend infrastructure and don’t work out of the box with Blazor WASM.

The only minor convenience was being able to launch both the API and Blazor project together. However, Visual Studio’s new Solution Startup Profiles feature (which was introduced alongside Aspire) provides the same benefit in a more straightforward way.

I expect the Aspire team will eventually focus on Blazor WASM integration. For now, it’s not a practical choice and requires extra effort with little benefit.

AI

Microsoft and others are adding a lot of support for AI in applications. .Net Aspire is no exception. You can quickly use Azure OpenAI or local AI Models for testing with the Aspire integrations.

Adding `dotnet add package CommunityToolkit.Aspire.Hosting.Ollama` is step one. More information at https://devblogs.microsoft.com/dotnet/local-ai-models-with-dotnet-aspire/.

Semantic Kernel is another great option for building AI Applications.

Deployment

.Net Aspire is geared toward the development story. Microsoft has admitted gaps in the deployment story but has been working to improve that.

You can quickly create and deploy to Azure with the `azd up` command, but you have very little control.

Keep an eye on updates for this process, but here are some resources to get you started.

https://devblogs.microsoft.com/dotnet/how-to-deploy-dotnet-aspire-apps-to-azure-container-apps

https://github.com/prom3theu5/aspirational-manifests

https://azure.github.io/aca-dotnet-workshop/aca/01-deploy-api-to-aca/

You’ll most likely continue using the pipelines you have to deploy your application. Dalton, Omnitech Engineer, said, "After adding Aspire, the existing pipelines worked as usual."

Conclusions

The team has made major improvements in .Net Aspire over the last year. We are evaluating this for new and existing projects. As with any tool, it won’t be the correct choice for all projects, but there is a lot of promise. We especially like the orchestration features, the ability to spin up services locally with containers for emulation, and best practices by default. We are hesitant to approach the complexities of microservice architecture (don’t go there until you need it) but Aspire will make that much easier to put together.

We’ll continue to monitor .Net Aspire and envision it being much more broadly used in the years to come.

Resources