SystemdHostBuilderExtensions.UseSystemd(IHostBuilder) 方法

定义

IHost 生存期配置为 SystemdLifetime,为应用程序启动和停止提供通知消息,并将控制台日志记录配置为系统格式。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Hosting::IHostBuilder ^ UseSystemd(Microsoft::Extensions::Hosting::IHostBuilder ^ hostBuilder);
public static Microsoft.Extensions.Hosting.IHostBuilder UseSystemd (this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder);
static member UseSystemd : Microsoft.Extensions.Hosting.IHostBuilder -> Microsoft.Extensions.Hosting.IHostBuilder
<Extension()>
Public Function UseSystemd (hostBuilder As IHostBuilder) As IHostBuilder

参数

hostBuilder
IHostBuilder

要配置的 IHostBuilder

返回

用于链接的 hostBuilder 实例。

注解

这是上下文感知的,仅当它检测到进程作为系统服务运行时才会激活。

必须使用 Type=notify 配置系统服务文件才能启用通知。 请参阅 https://www.freedesktop.org/software/systemd/man/systemd.service.html.

适用于