What are Hosting Integrations?
Hosting integrations extend theIDistributedApplicationBuilder with methods that add resources to your application model. Each integration:
- Manages container lifecycle for local development
- Configures connection strings and environment variables
- Provides health checks for dependent services
- Supports cloud deployment scenarios
Available Integrations
Databases
.NET Aspire includes hosting integrations for popular databases:- PostgreSQL - Open-source relational database
- SQL Server - Microsoft’s enterprise relational database
- Redis - In-memory data store for caching
- MongoDB - Document-oriented NoSQL database
Messaging
Message queue and streaming integrations:- RabbitMQ - Message broker
- Apache Kafka - Distributed event streaming platform
Azure Services
.NET Aspire provides first-class support for Azure services:- Azure Overview - Core Azure integration capabilities
- Azure Cosmos DB - Globally distributed NoSQL database
- Azure Storage - Blob, queue, and table storage
- Azure Service Bus - Enterprise messaging service
How to Use Hosting Integrations
Installation
Install the hosting integration package for the service you want to use:Add to AppHost
In your AppHost project, use theAddXxx extension methods:
Reference from Services
When you useWithReference, connection information is automatically passed to the dependent service:
Common Patterns
Adding Resources with Configuration
Many integrations support configuration options:Using Volumes for Persistence
Add volumes to persist data across container restarts:Adding Multiple Databases
Create multiple databases on a single server resource:Health Checks
Hosting integrations include built-in health checks. UseWaitFor to ensure dependencies are ready:
Connection Properties
Each hosting integration exposes connection properties as environment variables. The naming convention is[RESOURCE]_[PROPERTY].
For example, a resource named db with a Uri property becomes the environment variable DB_URI.
See individual integration pages for specific connection properties.
Next Steps
PostgreSQL
Add PostgreSQL database to your application
Redis
Add Redis caching to your application
Azure Services
Integrate with Azure cloud services
RabbitMQ
Add message queuing with RabbitMQ