# IDistributedApplicationLifecycleHook

- Kind: `interface`
- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Version: `13.4.0`
- Namespace: `Aspire.Hosting.Lifecycle`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/a3766e994fd2cba86c8ac60b8a80268cab7e6383/src/Aspire.Hosting/Lifecycle/IDistributedApplicationLifecycleHook.cs)

Defines an interface for hooks that are executed during the lifecycle of a distributed application.

## Definition

```csharp
namespace Aspire.Hosting.Lifecycle;

public interface IDistributedApplicationLifecycleHook
{
    // ...
}
```

## Methods

- [AfterEndpointsAllocatedAsync(DistributedApplicationModel, CancellationToken)](/reference/api/csharp/aspire.hosting/idistributedapplicationlifecyclehook/methods.md#afterendpointsallocatedasync-distributedapplicationmodel-cancellationtoken) : `Task` `virtual` -- Executes after the orchestrator allocates endpoints for resources in the application model.
- [AfterResourcesCreatedAsync(DistributedApplicationModel, CancellationToken)](/reference/api/csharp/aspire.hosting/idistributedapplicationlifecyclehook/methods.md#afterresourcescreatedasync-distributedapplicationmodel-cancellationtoken) : `Task` `virtual` -- Executes after the orchestrator has created the resources in the application model.
- [BeforeStartAsync(DistributedApplicationModel, CancellationToken)](/reference/api/csharp/aspire.hosting/idistributedapplicationlifecyclehook/methods.md#beforestartasync-distributedapplicationmodel-cancellationtoken) : `Task` `virtual` -- Executes before the distributed application starts.
