HostingHostBuilderExtensions.UseConsoleLifetime Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
UseConsoleLifetime(IHostBuilder) |
Listens for Ctrl+C or SIGTERM and calls StopApplication() to start the shutdown process. This will unblock extensions like RunAsync and WaitForShutdownAsync. |
UseConsoleLifetime(IHostBuilder, Action<ConsoleLifetimeOptions>) |
Listens for Ctrl+C or SIGTERM and calls StopApplication() to start the shutdown process. This will unblock extensions like RunAsync and WaitForShutdownAsync. |
UseConsoleLifetime(IHostBuilder)
Listens for Ctrl+C or SIGTERM and calls StopApplication() to start the shutdown process. This will unblock extensions like RunAsync and WaitForShutdownAsync.
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::Hosting::IHostBuilder ^ UseConsoleLifetime(Microsoft::Extensions::Hosting::IHostBuilder ^ hostBuilder);
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static Microsoft.Extensions.Hosting.IHostBuilder UseConsoleLifetime (this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder);
public static Microsoft.Extensions.Hosting.IHostBuilder UseConsoleLifetime (this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder);
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member UseConsoleLifetime : Microsoft.Extensions.Hosting.IHostBuilder -> Microsoft.Extensions.Hosting.IHostBuilder
static member UseConsoleLifetime : Microsoft.Extensions.Hosting.IHostBuilder -> Microsoft.Extensions.Hosting.IHostBuilder
<Extension()>
Public Function UseConsoleLifetime (hostBuilder As IHostBuilder) As IHostBuilder
Parameters
- hostBuilder
- IHostBuilder
The IHostBuilder to configure.
Returns
The same instance of the IHostBuilder for chaining.
- Attributes
Applies to
UseConsoleLifetime(IHostBuilder, Action<ConsoleLifetimeOptions>)
Listens for Ctrl+C or SIGTERM and calls StopApplication() to start the shutdown process. This will unblock extensions like RunAsync and WaitForShutdownAsync.
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::Hosting::IHostBuilder ^ UseConsoleLifetime(Microsoft::Extensions::Hosting::IHostBuilder ^ hostBuilder, Action<Microsoft::Extensions::Hosting::ConsoleLifetimeOptions ^> ^ configureOptions);
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public static Microsoft.Extensions.Hosting.IHostBuilder UseConsoleLifetime (this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, Action<Microsoft.Extensions.Hosting.ConsoleLifetimeOptions> configureOptions);
public static Microsoft.Extensions.Hosting.IHostBuilder UseConsoleLifetime (this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, Action<Microsoft.Extensions.Hosting.ConsoleLifetimeOptions> configureOptions);
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
static member UseConsoleLifetime : Microsoft.Extensions.Hosting.IHostBuilder * Action<Microsoft.Extensions.Hosting.ConsoleLifetimeOptions> -> Microsoft.Extensions.Hosting.IHostBuilder
static member UseConsoleLifetime : Microsoft.Extensions.Hosting.IHostBuilder * Action<Microsoft.Extensions.Hosting.ConsoleLifetimeOptions> -> Microsoft.Extensions.Hosting.IHostBuilder
<Extension()>
Public Function UseConsoleLifetime (hostBuilder As IHostBuilder, configureOptions As Action(Of ConsoleLifetimeOptions)) As IHostBuilder
Parameters
- hostBuilder
- IHostBuilder
The IHostBuilder to configure.
- configureOptions
- Action<ConsoleLifetimeOptions>
The delegate for configuring the ConsoleLifetime.
Returns
The same instance of the IHostBuilder for chaining.
- Attributes