aspire run
Run an Aspire AppHost interactively for development.Usage
Description
Theaspire run command builds and runs your Aspire AppHost, starting all configured resources and launching the Aspire Dashboard for monitoring and debugging.
What Happens When You Run
- Builds the AppHost - Compiles your AppHost project and its dependencies
- Trusts certificates - Ensures HTTPS development certificates are trusted
- Starts resources - Launches all services, containers, and infrastructure defined in your AppHost
- Opens the Dashboard - Provides a web-based UI for monitoring resources, logs, and traces
- Establishes backchannel - Creates a communication channel between the CLI and AppHost for status updates
Ctrl+C.
Options
The path to the Aspire AppHost project fileExample:
--apphost ./src/MyApp.AppHost/MyApp.AppHost.csprojIf not specified, the CLI searches for an AppHost project in the current directory and parent directories.Run the AppHost in the background and exit after it startsExample:
aspire run --detachIn detached mode, the CLI:- Spawns the AppHost as a background process
- Waits for the Dashboard to become available
- Displays connection info (AppHost path, Dashboard URL, PID, logs)
- Exits, leaving the AppHost running
aspire stop to stop detached instances.Do not build or restore the project before runningExample:
aspire run --no-buildUseful when you’ve already built the project and want to skip the build step. Cannot be used with watch mode.Output format for detached AppHost results:
json or textExample: aspire run --detach --format jsonOnly valid with --detach. JSON output includes:Run in isolated mode with randomized ports and isolated user secretsExample:
aspire run --isolatedIsolated mode:- Randomizes all endpoint ports to avoid conflicts
- Copies user secrets to a temporary isolated location
- Allows multiple instances of the same AppHost to run simultaneously
- Ideal for running multiple branches or testing different configurations
Examples
Run in the current directory
Run with a specific AppHost
Run in detached mode
aspire stop to stop it.
Run in detached mode with JSON output
Run in isolated mode
Skip the build
Dashboard Features
The Aspire Dashboard provides:Resources View
- See all services, containers, and infrastructure
- Monitor health status and state (Starting, Running, Stopped)
- View endpoint URLs for each resource
- Inspect environment variables and configuration
Structured Logs
- View logs from all resources in real-time
- Filter by resource, log level, or search text
- Export logs for analysis
Distributed Tracing
- View traces across service boundaries
- Inspect trace details and timing
- Identify performance bottlenecks
Metrics
- Monitor CPU, memory, and request metrics
- View custom metrics from your services
- Visualize trends over time
Stopping the AppHost
Foreground Mode
PressCtrl+C in the terminal where aspire run is running:
Detached Mode
Use theaspire stop command:
Running Instance Detection
When you runaspire run, the CLI automatically:
- Detects any running instances of the same AppHost
- Stops the existing instance before starting a new one
- Prevents port conflicts and resource contention
Logs
All AppHost logs are written to a unified log file:Debugging
To debug your AppHost:Watch Mode
By default, the Aspire CLI enables watch mode for project resources when running under the VS Code extension. In watch mode:- Changes to project files trigger automatic rebuilds
- Updated services restart with the latest code
- Provides a rapid inner-loop development experience
Remote Environments
In remote environments (GitHub Codespaces, VS Code Remote Containers, SSH), the Dashboard provides:- Forwarded URLs for accessing the Dashboard remotely
- Automatic endpoint discovery and display
- Real-time resource status updates
Troubleshooting
AppHost fails to start
Check the logs:- Port conflicts (solution: use
--isolated) - Missing dependencies (solution: run
dotnet restore) - Certificate issues (solution: run
dotnet dev-certs https --trust)
Dashboard doesn’t open
The Dashboard URL is displayed in the terminal. Copy and paste it into your browser:?t= query parameter is a login token for security.
Multiple instances conflict
Use isolated mode:See Also
- CLI Overview - Complete CLI command reference
- aspire deploy - Deploy your AppHost to production