ConsoleLifetime 类

定义

侦听 Ctrl+C 或 SIGTERM 并启动关闭进程。

public ref class ConsoleLifetime : IDisposable, Microsoft::Extensions::Hosting::IHostLifetime
public class ConsoleLifetime : IDisposable, Microsoft.Extensions.Hosting.IHostLifetime
[System.Runtime.Versioning.UnsupportedOSPlatform("android")]
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public class ConsoleLifetime : IDisposable, Microsoft.Extensions.Hosting.IHostLifetime
type ConsoleLifetime = class
    interface IHostLifetime
    interface IDisposable
[<System.Runtime.Versioning.UnsupportedOSPlatform("android")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
type ConsoleLifetime = class
    interface IHostLifetime
    interface IDisposable
Public Class ConsoleLifetime
Implements IDisposable, IHostLifetime
继承
ConsoleLifetime
属性
实现

注解

此 API 支持 .NET 基础结构,不应直接从代码中使用。

构造函数

ConsoleLifetime(IOptions<ConsoleLifetimeOptions>, IHostEnvironment, IHostApplicationLifetime, IOptions<HostOptions>)

此 API 支持基础结构,不应从代码中直接使用。 将来的版本中可能会更改或删除此 API。

ConsoleLifetime(IOptions<ConsoleLifetimeOptions>, IHostEnvironment, IHostApplicationLifetime, IOptions<HostOptions>, ILoggerFactory)

此 API 支持基础结构,不应从代码中直接使用。 将来的版本中可能会更改或删除此 API。

ConsoleLifetime(IOptions<ConsoleLifetimeOptions>, IHostingEnvironment, IApplicationLifetime)

此 API 支持基础结构,不应从代码中直接使用。 将来的版本中可能会更改或删除此 API。

方法

Dispose()

执行与释放或重置非托管资源关联的应用程序定义的任务。

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
StopAsync(CancellationToken)

StopAsync(CancellationToken) 调用,以指示主机正在停止并且可以关闭。

ToString()

返回表示当前对象的字符串。

(继承自 Object)
WaitForStartAsync(CancellationToken)

在 的 StartAsync(CancellationToken)开头调用,该调用将等到它完成,然后继续。 它可用于延迟启动,直到外部事件发出信号。

适用于