aspire wait command
Name
aspire wait - Wait for a resource to reach a target status.
Synopsis
aspire wait [options]
Description
The aspire wait command blocks until a named resource within a running AppHost reaches a target status. This is useful for CI/CD pipelines and automation workflows where you need to wait for resources to be ready after starting an AppHost with aspire run --detach.
The command connects to a running AppHost via the backchannel and streams resource state changes in real-time. It validates that the specified resource exists before entering the wait loop, so typos in resource names are caught immediately rather than causing a silent timeout.
When executed without the --apphost option, the command:
- Scans for all running AppHost processes.
- If multiple AppHosts are running within the current directory scope, prompts you to select which one to target.
- If only one AppHost is running in scope, connects to it directly.
- If no in-scope AppHosts are found but out-of-scope AppHosts exist, displays all running AppHosts for selection.
Arguments
<resource>The name of the resource to wait for. This must match the name of a resource defined in the running AppHost.
Options
The following options are available:
--status <healthy|up|down>The target status to wait for. Defaults to
healthy. The following values are supported:Value Condition healthyResource is running and healthy, or running with no health checks configured upResource is running, regardless of health status downResource has finished, exited, or failed to start Values are case-insensitive.
--timeout <seconds>The maximum number of seconds to wait for the resource to reach the target status. Defaults to
120. Must be a positive integer.--apphost <apphost>The path to the Aspire AppHost project file. When specified, the command connects to the AppHost running from that apphost without prompting for selection.
-
-
-
-
-
Exit codes
-
-
-
-
| Code | Meaning |
|---|---|
| 0 | Resource reached the target status |
| 7 | No running AppHost found |
| 17 | Timeout exceeded before the resource reached the target status |
| 18 | Resource entered a failed or terminal state while waiting for up or healthy |
Examples
Wait for a resource to be healthy (default):
aspire wait webfrontendWait for a resource to be running:
aspire wait mydb --status upWait for a resource to stop:
aspire wait worker --status downWait with a custom timeout of 60 seconds:
aspire wait webfrontend --timeout 60Target a specific AppHost project:
aspire wait mydb --apphost './src/MyApp.AppHost/MyApp.AppHost.csproj'Use with
aspire run --detachin a CI/CD pipeline:aspire run --detach aspire wait webfrontend aspire wait mydb --status healthy