Dotnet Aspire
Dotnet Aspire
Aspire - What is it?
.NET Aspire is an opinionated, cloud ready stack for building observable, production ready, distributed applications. - Microsoft
Aspire - What is it? (2)
opinionated | Aspire has its own opinions on how to do certain things. |
cloud ready | The focus for Aspire is to build applications that run in the cloud. |
observable | Monitoring, telemetry and system overview play a vital part. |
production ready | Effectiveness, efficiency and reliability. |
distributed | Aspire applications consist of more than one software part that work together. |
Aspire - How?
.NET Aspire is delivered through a collection of NuGet packages that handle specific cloud-native concerns.
Cloud-native apps often consist of small, interconnected pieces or microservices rather than a single, monolithic code base.
Cloud-native apps generally consume a large number of services, such as databases, messaging, and caching.
Aspire - Distributed
A distributed application is one that uses computational resources across multiple nodes, such as containers running on different hosts.
Such nodes must communicate over network boundaries to deliver responses to users.
A cloud-native app is a specific type of distributed app that takes full advantage of the scalability, resilience, and manageability of cloud infrastructures.
Aspire - Parts
- Orchestration
- provides features for running and connecting multi-project applications and their dependencies.
- Components
- Aspire components are NuGet packages for commonly used services, such as Redis or Postgres, with standardized interfaces ensuring they connect consistently and seamlessly with your app.
- Tooling
- Aspire comes with project templates and tooling experiences for Visual Studio/Rider and the dotnet CLI help you create and interact with .NET Aspire apps.
Aspire - Orchestration
… means the coordination and management of various elements within a cloud-native application.
- App composition
- Specify the .NET projects, containers, executables, and cloud resources that make up the application.
- Service discovery and connection string management
- The app host manages injecting the right connection strings and service discovery information to simplify the developer experience.
Aspire - Orchestration example
Aspire - Template
Aspire - Template - AppHost
The Orchestration Part of the Aspire application and the startup project.
Aspire - Template - ServiceDefaults
Configuration via code that can be shared in different projects.
Other projects call the AddServiceDefaults
extension method.
Aspire - Template - Web/ApiService
These are standard C# projects for a REST API and a web frontend. They can use Aspire for standard configuration and service discovery though.
Aspire - Dashboard
Aspire ships with a dashboard primarily meant for local development and analysis. Currently there is no standard way to deploy the dashboard to production applications, although the community issued the wish.
To use dotnet Aspire you might need to run