一键导入
aspire-apphost-wiring
How to wire up .NET Aspire 13.1 AppHost with containers, databases, and service projects
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
How to wire up .NET Aspire 13.1 AppHost with containers, databases, and service projects
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Full-stack acceptance testing with Aspire.Hosting.Testing — launching entire AppHost including containers
Patterns for integration testing Aspire-hosted .NET services with WebApplicationFactory, Testcontainers, and SQLite
Pattern for hosting Discord.NET bot inside a .NET generic host BackgroundService
Patterns for setting up a .NET CI pipeline with GitHub Actions and xUnit test projects
基于 SOC 职业分类
| name | aspire-apphost-wiring |
| description | How to wire up .NET Aspire 13.1 AppHost with containers, databases, and service projects |
| domain | infrastructure |
| confidence | low |
| source | earned |
When scaffolding a .NET Aspire 13.1 solution with multiple services, containers, and infrastructure resources. Applies to any project using Aspire for orchestration.
aspire-apphost for the orchestrator (generates AppHost.cs, not Program.cs)aspire-servicedefaults for shared defaults (OTel, health checks, service discovery)webapi, worker, classlib templates for service projects — Aspire doesn't need special service templatesNon-HTTP containers (Minecraft, game servers, TCP services) need explicit scheme: "tcp":
.WithEndpoint(targetPort: 25565, port: 25565, name: "minecraft", scheme: "tcp")
Use builder.AddParameter("name", secret: true) for secrets that containers need:
.WithEnvironment("RCON_PASSWORD", builder.AddParameter("rcon-password", secret: true))
This integrates with user secrets in dev and proper stores in production.
Services call builder.AddServiceDefaults() plus their specific Aspire client integrations:
builder.AddNpgsqlDbContext<MyDbContext>("connectionName");
builder.AddRedisClient("redis");
The connection name must match what the AppHost defines (e.g., .AddDatabase("bridgedb") → "bridgedb").
Microsoft.EntityFrameworkCore.Design must be in BOTH the data class library AND the startup project for dotnet ef migrations to work.
See src/AppHost/AppHost.cs in the Discord-Minecraft project for a complete multi-service, multi-container orchestration.
aspire-starter if you need custom project layouts — scaffold individual projects insteadWaitFor() chains — services that depend on infrastructure should wait for it