SystemdHostBuilderExtensions.UseSystemd(IHostBuilder) 方法

定义

将主机生存期设置为 SystemdLifetime,为已启动和正在停止的应用程序提供通知消息,并将控制台日志记录配置为 systemd 格式。

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

返回

IHostBuilder

hostBuilder用于链接的实例。

注解

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

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

适用于