Compartir a través de


HostingHostBuilderExtensions.RunConsoleAsync Método

Definición

Sobrecargas

RunConsoleAsync(IHostBuilder, CancellationToken)

Habilita la compatibilidad de la consola, compila e inicia el host, y espera a que se cierre Ctrl+C o SIGTERM.

RunConsoleAsync(IHostBuilder, Action<ConsoleLifetimeOptions>, CancellationToken)

Habilita la compatibilidad de la consola, compila e inicia el host, y espera a que se cierre Ctrl+C o SIGTERM.

RunConsoleAsync(IHostBuilder, CancellationToken)

Source:
HostingHostBuilderExtensions.cs
Source:
HostingHostBuilderExtensions.cs
Source:
HostingHostBuilderExtensions.cs
Source:
HostingHostBuilderExtensions.cs

Habilita la compatibilidad de la consola, compila e inicia el host, y espera a que se cierre Ctrl+C o SIGTERM.

[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

Parámetros

hostBuilder
IHostBuilder

El objeto IHostBuilder que se va a configurar.

cancellationToken
CancellationToken

Se puede usar una instancia de CancellationToken para cancelar la consola.

Devoluciones

Solo se completa un Task cuando se señala el token o se cierra la aplicación.

Atributos

Excepciones

Se canceló el token de cancelación. Esta excepción se almacena en la tarea devuelta.

Se aplica a

RunConsoleAsync(IHostBuilder, Action<ConsoleLifetimeOptions>, CancellationToken)

Source:
HostingHostBuilderExtensions.cs
Source:
HostingHostBuilderExtensions.cs
Source:
HostingHostBuilderExtensions.cs
Source:
HostingHostBuilderExtensions.cs

Habilita la compatibilidad de la consola, compila e inicia el host, y espera a que se cierre Ctrl+C o SIGTERM.

[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

Parámetros

hostBuilder
IHostBuilder

El objeto IHostBuilder que se va a configurar.

configureOptions
Action<ConsoleLifetimeOptions>

El delegado para configurar ConsoleLifetime.

cancellationToken
CancellationToken

Se puede usar una instancia de CancellationToken para cancelar la consola.

Devoluciones

Solo se completa un Task cuando se señala el token o se cierra la aplicación.

Atributos

Excepciones

Se canceló el token de cancelación. Esta excepción se almacena en la tarea devuelta.

Se aplica a