# DistributedApplication.Run

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Defined on: [DistributedApplication](/reference/api/go/aspire.hosting/distributedapplication.md)
- Version: `17.0.0`
- Kind: `method`

Runs the distributed application

## Remarks

When the Aspire AppHost is launched via `RunAsync` there are
two possible modes that it is running in:
-
-
Developers extending the Aspire application model should consider the lifetime
of `IHostedService` instances which are added to the dependency injection
container. For more information on determining the mode that the AppHost is running
in refer to `DistributedApplicationExecutionContext`.

## Definition

```go
type DistributedApplication interface {
    // ... omitted for brevity
    Run(options ...*RunOptions) error
}
```

## Signature

```go
Run(options ...*RunOptions) error
```

## Parameters

- `options` (`...*RunOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*RunOptions` argument.

- `CancellationToken` (`*CancellationToken`) -- The token to trigger shutdown.

## Returns

`error` -- The `Task` that represents the asynchronous operation.

Returns `error`.

## Defined on

- [DistributedApplication](/reference/api/go/aspire.hosting/distributedapplication.md) -- `handle`
