Skip to content
DocsTry Aspire
DocsTry

aspire stop command

aspire stop - Stop a running Aspire AppHost.

Aspire CLI
aspire stop [options]

The aspire stop command stops a running Aspire AppHost process. When no options are provided, the command scans for running AppHosts and stops the in-scope AppHost directly, or prompts you to choose one when multiple AppHosts are available.

When executed without the --apphost option, the command:

  1. Scans for all running AppHost processes.
  2. If multiple AppHosts are running within the current directory scope, prompts you to select which one to stop.
  3. If only one AppHost is running in scope, stops it directly.
  4. If no in-scope AppHosts are found but out-of-scope AppHosts exist, displays all running AppHosts for selection.

The command requests a graceful shutdown of the selected AppHost process (and its process tree), coordinating a clean shutdown of the AppHost, dashboard, and non-persistent containers and processes. Resources configured with a persistent lifetime remain available for later runs.

Use --force to stop the selected AppHost and then remove the persistent resources associated with it:

Aspire CLI
aspire stop --force

The command performs the normal stop flow first, then removes persistent resources associated with the AppHost. The command attempts to clean up persistent resources whether or not an instance of the AppHost is running. Persistent resources started using a version of the Aspire CLI released before --force support was added can’t be cleaned up using --force.

Additional notes and limitations:

  • You can’t combine --force with --all; cleaning up persistent resources is only supported when stopping instances of a specific AppHost.
  • AppHost instances and associated persistent resources are resolved based on the AppHost path. If you remove or rename an AppHost after it creates persistent resources, the command won’t associate previously created persistent resources with the AppHost at its new path. In that case, either run aspire stop --force before renaming the AppHost or manually clean up the associated persistent resources.
  • For a .NET AppHost that doesn’t use the Aspire CLI bundle, cleanup requires Aspire.Hosting 13.5 or later. If the AppHost uses an older version, its version can’t be determined, or its project can’t be inspected, the command displays a warning and still attempts cleanup. Resources created without the required workload metadata might remain.
  • If the AppHost stops successfully, but persistent resource cleanup fails, the command exits with an error but leaves the AppHost stopped. You can resolve any errors and run aspire stop --force again or manually clean up any remaining persistent resources if necessary.

The following options are available:

  • --apphost <apphost>

    The path to the Aspire AppHost project file. When specified, the command stops only the AppHost running from that AppHost project without prompting for selection.

  • --all

    Stop all running AppHosts without prompting for selection. You can’t combine this option with --force.

  • --force

    Perform the normal attempt to stop all instances of a specific AppHost, then attempt to clean up persistent resources associated with that AppHost. You can combine this option with --apphost to specify an AppHost to stop, but not with --all.

  • -?, -h, --help

    Prints help and usage documentation for the available commands and options.

  • -l, --log-level <Critical|Debug|Error|Information|None|Trace|Warning>

    Set the minimum log level for console output. Use this option to increase diagnostics while troubleshooting or reduce output in scripted runs.

  • --non-interactive

    Run the command in non-interactive mode, disabling all interactive prompts and spinners.

  • --nologo

    Suppress the startup banner and telemetry notice.

  • --banner

    Display the animated Aspire CLI welcome banner.

  • --wait-for-debugger

    Wait for a debugger to attach before running a command.

  • Stop the AppHost running in the current directory scope:

    Aspire CLI
    aspire stop
  • Stop a specific AppHost project:

    Aspire CLI
    aspire stop --apphost './src/MyApp.AppHost/MyApp.AppHost.csproj'
  • Stop all running AppHosts:

    Aspire CLI
    aspire stop --all
  • Stop the AppHost and clean up its persistent resources:

    Aspire CLI
    aspire stop --force
  • Stop any running instances and clean up persistent resources for a specific AppHost when the target AppHost might be ambiguous:

    Aspire CLI
    aspire stop --force --apphost './src/MyApp.AppHost/MyApp.AppHost.csproj'