Partager via


DistributedApplication.Run Method

Definition

Runs an application and blocks the calling thread until host shutdown is triggered and all IHostedService instances are stopped.

public void Run ();
member this.Run : unit -> unit
Public Sub Run ()

Remarks

When the .NET Aspire app host is launched via RunAsync(CancellationToken) there are two possible modes that it is running in:

Developers extending the .NET 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 app host is running in refer to DistributedApplicationExecutionContext.

Applies to