title | description | ms.date | ms.topic | uid |
---|---|---|---|---|
.NET Aspire integrations overview |
Explore the fundamental concepts of .NET Aspire integrations and learn how to integrate them into your apps. |
09/25/2024 |
conceptual |
aspire/integrations |
.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.
Tip
Always strive to use the latest version of .NET Aspire integrations to take advantage of the latest features, improvements, and security updates.
Most .NET Aspire integrations are made up of two separate libraries, each with a different responsibility. One type represents resources within the app host project—known as hosting integrations. The other type of integration represents client libraries that connect to the resources modeled by hosting integrations, and they're known as client integrations.
Hosting integrations configure applications by provisioning resources (like containers or cloud resources) or pointing to existing instances (such as a local SQL server). These packages model various services, platforms, or capabilities, including caches, databases, logging, storage, and messaging systems.
Hosting integrations extend the xref:Aspire.Hosting.IDistributedApplicationBuilder interface, enabling the app host project to express resources within its app model. The official hosting integration NuGet packages are tagged with aspire
, integration
, and hosting
.
For information on creating a custom hosting integration, see Create custom .NET Aspire hosting integration.
Client integrations wire up client libraries to dependency injection (DI), define configuration schema, and add health checks, resiliency, and telemetry where applicable. These packages configure existing client libraries to connect to hosting integrations. They extend the xref:Microsoft.Extensions.Hosting.IHostApplicationBuilder interface allowing client-consuming projects, such as your web app or API, to use the connected resource. The official client integration NuGet packages are tagged with aspire
, integration
, and client
.
For more information on creating a custom client integration, see Create custom .NET Aspire client integrations.
Hosting and client integrations are best when used together, but are not coupled and can be used separately. Some hosting integrations don't have a corresponding client integration. Configuration is what makes the hosting integration work with the client integration.
Consider the following diagram that depicts the relationship between hosting and client integrations:
:::image type="content" source="media/integrations-thumb.png" lightbox="media/integrations.png" alt-text="A diagram ":::
The app host project is where hosting integrations are used. Configuration, specifically environment variables, is injected into projects, executables, and containers, allowing client integrations to connect to the hosting integrations.
When you add a client integration to a project within your .NET Aspire solution, service defaults are automatically applied to that project; meaning the Service Defaults project is referenced and the AddServiceDefaults
extension method is called. These defaults are designed to work well in most scenarios and can be customized as needed. The following service defaults are applied:
-
Observability and telemetry: Automatically sets up logging, tracing, and metrics configurations:
- Logging: A technique where code is instrumented to produce logs of interesting events that occurred while the program was running.
- Tracing: A specialized form of logging that helps you localize failures and performance issues within applications distributed across multiple machines or processes.
- Metrics: Numerical measurements recorded over time to monitor application performance and health. Metrics are often used to generate alerts when potential problems are detected.
-
Health checks: Exposes HTTP endpoints to provide basic availability and state information about an app. Health checks are used to influence decisions made by container orchestrators, load balancers, API gateways, and other management services.
-
Resiliency: The ability of your system to react to failure and still remain functional. Resiliency extends beyond preventing failures to include recovering and reconstructing your cloud-native environment back to a healthy state.
.NET Aspire provides many integrations to help you build cloud-native applications. These integrations are designed to work seamlessly with the .NET Aspire app host and client libraries. The following sections detail cloud-agnostic, Azure-specific, and Amazon Web Services (AWS) integrations.
The following section details cloud-agnostic .NET Aspire integrations with links to their respective docs and NuGet packages, and provides a brief description of each integration.
For more information on working with .NET Aspire integrations in Visual Studio, see Visual Studio tooling.
Azure integrations configure applications to use Azure resources. These hosting integrations are available in the Aspire.Hosting.Azure.*
NuGet packages, while their client integrations are available in the Aspire.*
NuGet packages:
Integration docs and NuGet packages | Description |
---|---|
- Learn more: 📄 AWS Hosting - Hosting: 📦 Aspire.Hosting.AWS - Client: N/A |
A library for modeling AWS resources. |
For more information, see GitHub: Aspire.Hosting.AWS library.