Bagikan melalui


HostingHostBuilderExtensions.RunConsoleAsync Metode

Definisi

Overload

RunConsoleAsync(IHostBuilder, CancellationToken)

Memungkinkan dukungan konsol, membangun, dan memulai host, dan menunggu Ctrl+C atau SIGTERM dimatikan.

RunConsoleAsync(IHostBuilder, Action<ConsoleLifetimeOptions>, CancellationToken)

Memungkinkan dukungan konsol, membangun, dan memulai host, dan menunggu Ctrl+C atau SIGTERM dimatikan.

RunConsoleAsync(IHostBuilder, CancellationToken)

Sumber:
HostingHostBuilderExtensions.cs
Sumber:
HostingHostBuilderExtensions.cs
Sumber:
HostingHostBuilderExtensions.cs
Sumber:
HostingHostBuilderExtensions.cs

Memungkinkan dukungan konsol, membangun, dan memulai host, dan menunggu Ctrl+C atau SIGTERM dimatikan.

[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Threading.Tasks.Task RunConsoleAsync (this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task RunConsoleAsync (this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, System.Threading.CancellationToken cancellationToken = default);
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member RunConsoleAsync : Microsoft.Extensions.Hosting.IHostBuilder * System.Threading.CancellationToken -> System.Threading.Tasks.Task
static member RunConsoleAsync : Microsoft.Extensions.Hosting.IHostBuilder * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function RunConsoleAsync (hostBuilder As IHostBuilder, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameter

hostBuilder
IHostBuilder

untuk IHostBuilder mengonfigurasi.

cancellationToken
CancellationToken

Yang CancellationToken dapat digunakan untuk membatalkan konsol.

Mengembalikan

Task Yang hanya selesai ketika token diberi sinyal atau aplikasi dimatikan.

Atribut

Pengecualian

Token pembatalan dibatalkan. Pengecualian ini disimpan ke dalam tugas yang dikembalikan.

Berlaku untuk

RunConsoleAsync(IHostBuilder, Action<ConsoleLifetimeOptions>, CancellationToken)

Sumber:
HostingHostBuilderExtensions.cs
Sumber:
HostingHostBuilderExtensions.cs
Sumber:
HostingHostBuilderExtensions.cs
Sumber:
HostingHostBuilderExtensions.cs

Memungkinkan dukungan konsol, membangun, dan memulai host, dan menunggu Ctrl+C atau SIGTERM dimatikan.

[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static System.Threading.Tasks.Task RunConsoleAsync (this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, Action<Microsoft.Extensions.Hosting.ConsoleLifetimeOptions> configureOptions, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task RunConsoleAsync (this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, Action<Microsoft.Extensions.Hosting.ConsoleLifetimeOptions> configureOptions, System.Threading.CancellationToken cancellationToken = default);
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member RunConsoleAsync : Microsoft.Extensions.Hosting.IHostBuilder * Action<Microsoft.Extensions.Hosting.ConsoleLifetimeOptions> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
static member RunConsoleAsync : Microsoft.Extensions.Hosting.IHostBuilder * Action<Microsoft.Extensions.Hosting.ConsoleLifetimeOptions> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
<Extension()>
Public Function RunConsoleAsync (hostBuilder As IHostBuilder, configureOptions As Action(Of ConsoleLifetimeOptions), Optional cancellationToken As CancellationToken = Nothing) As Task

Parameter

hostBuilder
IHostBuilder

untuk IHostBuilder mengonfigurasi.

configureOptions
Action<ConsoleLifetimeOptions>

Delegasi untuk mengonfigurasi ConsoleLifetime.

cancellationToken
CancellationToken

Yang CancellationToken dapat digunakan untuk membatalkan konsol.

Mengembalikan

Task Yang hanya selesai ketika token diberi sinyal atau aplikasi dimatikan.

Atribut

Pengecualian

Token pembatalan dibatalkan. Pengecualian ini disimpan ke dalam tugas yang dikembalikan.

Berlaku untuk