-
Notifications
You must be signed in to change notification settings - Fork 668
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Aspire resources cannot wait for external services, so they will start even if the external service reports an unhealthy status:
var builder = DistributedApplication.CreateBuilder(args);
var externalApi = builder.AddExternalService("backend-api", "http://localhost:5082")
.WithHttpHealthCheck("/health/ready");
builder.AddProject<BlazorApp1>("frontend")
.WaitFor(externalApi); // Won't wait
builder.Build().Run();

Expected Behavior
Any resource that waits on an external service, where that external service includes a health check, should not start until the external service is healthy.
Steps To Reproduce
- Create a new Aspire application with an external service resource (does not even need to exist) and a vanilla Blazor project that waits for the external service:
var builder = DistributedApplication.CreateBuilder(args);
var externalApi = builder.AddExternalService("backend-api", "http://localhost:5082")
.WithHttpHealthCheck("/health/ready");
builder.AddProject<BlazorApp1>("frontend")
.WaitFor(externalApi);
builder.Build().Run();
- Ensure the external service is not running at all
- Start the Aspire AppHost
- Go to the Aspire dashboard
- The external service reports
Running (Unhealthy)
state - The frontend, however, entered
Running
state

Exceptions (if any)
No response
.NET Version info
.NET SDK:
Version: 9.0.303
Commit: 5d97611193
Workload version: 9.0.300-manifests.fadeff71
MSBuild version: 17.14.13+65391c53b
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.303\
.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.7
Architecture: x64
Commit: 3c298d9f00
.NET SDKs installed:
8.0.412 [C:\Program Files\dotnet\sdk]
9.0.303 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Anything else?
.NET Aspire version: 9.4
IDE: VS Code