編輯

共用方式為


.NET Aspire integrations overview

.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.

Integration responsibilities

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

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 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

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 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.

Relationship between hosting and 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:

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.

Integration features

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.

Official integrations

.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, Amazon Web Services (AWS), and Community Toolkit integrations.

Cloud-agnostic 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.

Integration docs and NuGet packages Description
- Learn more: 📄 Apache Kafka
- Hosting: 📦 Aspire.Hosting.Kafka
- Client: 📦 Aspire.Confluent.Kafka
A library for producing and consuming messages from an Apache Kafka broker.
- Learn more: 📄 Dapr
- Hosting: 📦 Aspire.Hosting.Dapr
- Client: N/A
A library for modeling Dapr as a .NET Aspire resource.
- Learn more: 📄 Elasticsearch
- Hosting: 📦 Aspire.Hosting.Elasticsearch
- Client: 📦 Aspire.Elastic.Clients.Elasticsearch
A library for accessing Elasticsearch databases.
- Learn more: 📄 Keycloak
- Hosting: 📦 Aspire.Hosting.Keycloak
- Client: 📦 Aspire.Keycloak.Authentication
A library for accessing Keycloak authentication.
- Learn more: 📄 Milvus
- Hosting: 📦 Aspire.Hosting.Milvus
- Client: 📦 Aspire.Milvus.Client
A library for accessing Milvus databases.
- Learn more: 📄 MongoDB Driver
- Hosting: 📦 Aspire.Hosting.MongoDB
- Client: 📦 Aspire.MongoDB.Driver
A library for accessing MongoDB databases.
- Learn more: 📄 MySqlConnector
- Hosting: 📦 Aspire.Hosting.MySql
- Client: 📦 Aspire.MySqlConnector
A library for accessing MySqlConnector databases.
- Learn more: 📄 NATS
- Hosting: 📦 Aspire.Hosting.Nats
- Client: 📦 Aspire.NATS.Net
A library for accessing NATS messaging.
- Learn more: 📄 Oracle - EF Core
- Hosting: 📦 Aspire.Hosting.Oracle
- Client: 📦 Aspire.Oracle.EntityFrameworkCore
A library for accessing Oracle databases with Entity Framework Core.
- Learn more: 📄 Orleans
- Hosting: 📦 Aspire.Hosting.Orleans
- Client: N/A
A library for modeling Orleans as a .NET Aspire resource.
- Learn more: 📄 Pomelo MySQL - EF Core
- Hosting: 📦 Aspire.Hosting.MySql
- Client: 📦 Aspire.Pomelo.EntityFrameworkCore.MySql
A library for accessing MySql databases with Entity Framework Core.
- Learn more: 📄 PostgreSQL - EF Core
- Hosting: 📦 Aspire.Hosting.PostgreSQL
- Client: 📦 Aspire.Npgsql.EntityFrameworkCore.PostgreSQL
A library for accessing PostgreSQL databases using Entity Framework Core.
- Learn more: 📄 PostgreSQL
- Hosting: 📦 Aspire.Hosting.PostgreSQL
- Client: 📦 Aspire.Npgsql
A library for accessing PostgreSQL databases.
- Learn more: 📄 Qdrant
- Hosting: 📦 Aspire.Hosting.Qdrant
- Client: 📦 Aspire.Qdrant.Client
A library for accessing Qdrant databases.
- Learn more: 📄 RabbitMQ
- Hosting: 📦 Aspire.Hosting.RabbitMQ
- Client: 📦 Aspire.RabbitMQ.Client
A library for accessing RabbitMQ.
- Learn more: 📄 Redis Distributed Caching
- Hosting: 📦 Aspire.Hosting.Redis, 📦 Aspire.Hosting.Garnet, or 📦 Aspire.Hosting.Valkey
- Client: 📦 Aspire.StackExchange.Redis.DistributedCaching
A library for accessing Redis caches for distributed caching.
- Learn more: 📄 Redis Output Caching
- Hosting: 📦 Aspire.Hosting.Redis, 📦 Aspire.Hosting.Garnet, or 📦 Aspire.Hosting.Valkey
- Client: 📦 Aspire.StackExchange.Redis.OutputCaching
A library for accessing Redis caches for output caching.
- Learn more: 📄 Redis
- Hosting: 📦 Aspire.Hosting.Redis, 📦 Aspire.Hosting.Garnet, or 📦 Aspire.Hosting.Valkey
- Client: 📦 Aspire.StackExchange.Redis
A library for accessing Redis caches.
- Learn more: 📄 Seq
- Hosting: 📦 Aspire.Hosting.Seq
- Client: 📦 Aspire.Seq
A library for logging to Seq.
- Learn more: 📄 SQL Server - EF Core
- Hosting: 📦 Aspire.Hosting.SqlServer
- Client: 📦 Aspire.Microsoft.EntityFrameworkCore.SqlServer
A library for accessing SQL Server databases using EF Core.
- Learn more: 📄 SQL Server
- Hosting: 📦 Aspire.Hosting.SqlServer
- Client: 📦 Aspire.Microsoft.Data.SqlClient
A library for accessing SQL Server databases.

For more information on working with .NET Aspire integrations in Visual Studio, see Visual Studio tooling.

Azure integrations

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: 📄 Azure App Configuration
- Hosting: 📦 Aspire.Hosting.Azure.AppConfiguration
- Client: N/A
A library for interacting with Azure App Configuration.
- Learn more: 📄 Azure Application Insights
- Hosting: 📦 Aspire.Hosting.Azure.ApplicationInsights
- Client: N/A
A library for interacting with Azure Application Insights.
- Learn more: 📄 Azure Cosmos DB - EF Core
- Hosting: 📦 Aspire.Hosting.Azure.CosmosDB
- Client: 📦 Aspire.Microsoft.EntityFrameworkCore.Cosmos
A library for accessing Azure Cosmos DB databases with Entity Framework Core.
- Learn more: 📄 Azure Cosmos DB
- Hosting: 📦 Aspire.Hosting.Azure.CosmosDB
- Client: 📦 Aspire.Microsoft.Azure.Cosmos
A library for accessing Azure Cosmos DB databases.
- Learn more: 📄 Azure Event Hubs
- Hosting: 📦 Aspire.Hosting.Azure.EventHubs
- Client: 📦 Aspire.Azure.Messaging.EventHubs
A library for accessing Azure Event Hubs.
- Learn more: 📄 Azure Key Vault
- Hosting: 📦 Aspire.Hosting.Azure.KeyVault
- Client: 📦 Aspire.Azure.Security.KeyVault
A library for accessing Azure Key Vault.
- Learn more: 📄 Azure Operational Insights
- Hosting: 📦 Aspire.Hosting.Azure.OperationalInsights
- Client: N/A
A library for interacting with Azure Operational Insights.
- Learn more: 📄 Azure AI OpenAI
- Hosting: 📦 Aspire.Hosting.Azure.CognitiveServices
- Client: 📦 Aspire.Azure.AI.OpenAI
A library for accessing Azure AI OpenAI or OpenAI functionality.
- Learn more: 📄 Azure PostgreSQL
- Hosting: 📦 Aspire.Hosting.Azure.PostgreSQL
- Client: N/A
A library for interacting with Azure Database for PostgreSQL.
- Learn more: 📄 Azure AI Search
- Hosting: 📦 Aspire.Hosting.Azure.Search
- Client: 📦 Aspire.Azure.Search.Documents
A library for accessing Azure AI Search functionality.
- Learn more: 📄 Azure Service Bus
- Hosting: 📦 Aspire.Hosting.Azure.ServiceBus
- Client: 📦 Aspire.Azure.Messaging.ServiceBus
A library for accessing Azure Service Bus.
- Learn more: 📄 Azure SignalR Service
- Hosting: 📦 Aspire.Hosting.Azure.SignalR
- Client: Microsoft.Azure.SignalR
A library for accessing Azure SignalR Service.
- Learn more: 📄 Azure Blob Storage
- Hosting: 📦 Aspire.Hosting.Azure.Storage
- Client: 📦 Aspire.Azure.Storage.Blobs
A library for accessing Azure Blob Storage.
- Learn more: 📄 Azure Storage Queues
- Hosting: 📦 Aspire.Hosting.Azure.Storage
- Client: 📦 Aspire.Azure.Storage.Queues
A library for accessing Azure Storage Queues.
- Learn more: 📄 Azure Table Storage
- Hosting: 📦 Aspire.Hosting.Azure.Storage
- Client: 📦 Aspire.Azure.Data.Tables
A library for accessing the Azure Table service.
- Learn more: 📄 Azure Web PubSub
- Hosting: 📦 Aspire.Hosting.Azure.WebPubSub
- Client: 📦 Aspire.Azure.Messaging.WebPubSub
A library for accessing the Azure Web PubSub service.

Amazon Web Services (AWS) hosting integrations

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.

Community Toolkit integrations

Note

The Community Toolkit integrations are community-driven and maintained by the .NET Aspire community. These integrations are not officially supported by the .NET Aspire team.

Integration docs and NuGet packages Description
- Learn More: 📄 Azure Static Web Apps emulator
- Hosting: 📦 CommunityToolkit.Aspire.Hosting.Azure.StaticWebApps
- Client: N/A
A hosting integration for the Azure Static Web Apps emulator (Note: this does not support deployment of a project to Azure Static Web Apps).
- Learn More: 📄 Go hosting
- Hosting: 📦 CommunityToolkit.Aspire.Hosting.Golang
- Client: N/A
A hosting integration for Go apps.
Learn More: 📄 Java/Spring hosting
- Hosting: 📦 CommunityToolkit.Aspire.Hosting.Java
- Client: N/A
A integration for running Java code in .NET Aspire either using the local JDK or using a container.
- Learn More: 📄 Node.js hosting extensions
- Hosting: 📦 CommunityToolkit.Aspire.Hosting.NodeJs.Extensions
- Client: N/A
An integration that contains some additional extensions for running Node.js applications
- Learn More: 📄 Ollama
- Hosting: 📦 CommunityToolkit.Aspire.Hosting.Ollama
- Client: 📦 Aspire.CommunitToolkit.OllamaSharp
An Aspire component leveraging the Ollama container with support for downloading a model on startup.
- Learn More: 📄 Meilisearch hosting
- Hosting: 📦 CommunityToolkit.Aspire.Hosting.Meilisearch
- Client: 📦 Aspire.CommunitToolkit.Meilisearch
An Aspire component leveraging the Meilisearch container.

For more information, see GitHub: CommunityToolkit.Aspire library.