# DistributedApplicationExecutionContext Properties

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [DistributedApplicationExecutionContext](/reference/api/csharp/aspire.hosting/distributedapplicationexecutioncontext.md)
- Kind: `Properties`
- Members: `5`

Exposes the global contextual information for this invocation of the AppHost.

## IsPublishMode

- Name: `IsPublishMode`
- Modifiers: `get`
- Returns: `bool`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationExecutionContext.cs#L83)

Returns true if the current operation is publishing.

```csharp
public bool IsPublishMode { get; }
```

## IsRunMode

- Name: `IsRunMode`
- Modifiers: `get`
- Returns: `bool`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationExecutionContext.cs#L88)

Returns true if the current operation is running.

```csharp
public bool IsRunMode { get; }
```

## Operation

- Name: `Operation`
- Modifiers: `get`
- Returns: [DistributedApplicationOperation](/reference/api/csharp/aspire.hosting/distributedapplicationoperation.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationExecutionContext.cs#L56)

The operation currently being performed by the AppHost.

```csharp
public DistributedApplicationOperation Operation { get; }
```

## PublisherName

- Name: `PublisherName`
- Modifiers: `get; set`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationExecutionContext.cs)

The name of the publisher that is being used if [DistributedApplicationExecutionContext.Operation](/reference/api/csharp/aspire.hosting/distributedapplicationexecutioncontext/properties.md#operation) is set to [DistributedApplicationOperation.Publish](/reference/api/csharp/aspire.hosting/distributedapplicationoperation/fields.md).

```csharp
public string PublisherName { get; set; }
```

## ServiceProvider

- Name: `ServiceProvider`
- Modifiers: `get`
- Returns: `IServiceProvider`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/DistributedApplicationExecutionContext.cs#L66-L76)

The `IServiceProvider` for the AppHost.

```csharp
public IServiceProvider ServiceProvider { get; }
```

## Exceptions

- `InvalidOperationException` -- Thrown when the `IServiceProvider` is not available.
