Blog Logo

Understanding .NET Aspire Orchestration

Today, we’re going to delve into the world of .NET Aspire, a new and exciting technology that has been making waves in the .NET community. This article aims to provide an easy-to-understand introduction to orchestration in .NET Aspire, focusing on its benefits and capabilities. Let’s dive in and discover how .NET Aspire contributes to advancements in our day-by-day development. .NET Aspire is described as an “opinionated, cloud-ready stack for building observable, production-ready distributed applications.” Its a technology that consists of three main capabilities: Orchestration, Components, and Tooling. Orchestration: This allows developers to define how different services interact with each other. Components: These are the building blocks of your project, defining the types of services you want to include. If a service doesn’t have a corresponding component, you’ll need to create one. Tooling: This includes specific integrations in Visual Studio and the .NET CLI to facilitate the development process. The Role of .NET Aspire: .NET Aspire was born out of developers’ frustrations with deploying to the cloud. It provides additional tooling to wire up projects together in your orchestration project in Visual Studio, effectively simplifying the process of getting your application cloud-ready. However, this simplicity can be a double-edged sword. While it makes deployment easier, it can also lead to developers not fully understanding what they’re doing. They might end up following a sequence of steps without truly grasping the underlying principles. To understand how the application setup in .NET Aspire works, it’s worth taking a look at the sample projects Microsoft provides on their page. In this article, we will take a closer look at the eShopLite microservices example. You will find two Aspire projects: eShopLite.AppHost and eShopLite.ServiceDefaults. The .NET Aspire .ServiceDefaults project is a key project of the .NET Aspire application. It comes with a set of packages that provide functionalities such as telemetry, health checks, logging and metrics. When you create a new .NET Aspire project, the .ServiceDefaults project is added automatically to your solution. This project is specifically designed for sharing the Extensions.cs class and its functionality. Let’s take a look again at the eShop example:using Microsoft.AspNetCore.Builder;using Microsoft.AspNetCore.Diagnostics.HealthChecks;using Micr