WindowsServiceLifetimeHostBuilderExtensions.UseWindowsService 方法

定义

重载

UseWindowsService(IHostBuilder)

将主机生存期设置为 WindowsServiceLifetime,并使用应用程序名称作为默认源名称登录到事件日志。

UseWindowsService(IHostBuilder, Action<WindowsServiceLifetimeOptions>)

将主机生存期设置为 WindowsServiceLifetime,并使用应用程序名称作为默认源名称登录到事件日志。

UseWindowsService(IHostBuilder)

Source:
WindowsServiceLifetimeHostBuilderExtensions.cs
Source:
WindowsServiceLifetimeHostBuilderExtensions.cs

将主机生存期设置为 WindowsServiceLifetime,并使用应用程序名称作为默认源名称登录到事件日志。

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

参数

hostBuilder
IHostBuilder

要运行的 IHostBuilder

返回

用于链接的 hostBuilder 实例。

注解

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

适用于

UseWindowsService(IHostBuilder, Action<WindowsServiceLifetimeOptions>)

Source:
WindowsServiceLifetimeHostBuilderExtensions.cs
Source:
WindowsServiceLifetimeHostBuilderExtensions.cs

将主机生存期设置为 WindowsServiceLifetime,并使用应用程序名称作为默认源名称登录到事件日志。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Hosting::IHostBuilder ^ UseWindowsService(Microsoft::Extensions::Hosting::IHostBuilder ^ hostBuilder, Action<Microsoft::Extensions::Hosting::WindowsServiceLifetimeOptions ^> ^ configure);
public static Microsoft.Extensions.Hosting.IHostBuilder UseWindowsService (this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, Action<Microsoft.Extensions.Hosting.WindowsServiceLifetimeOptions> configure);
static member UseWindowsService : Microsoft.Extensions.Hosting.IHostBuilder * Action<Microsoft.Extensions.Hosting.WindowsServiceLifetimeOptions> -> Microsoft.Extensions.Hosting.IHostBuilder
<Extension()>
Public Function UseWindowsService (hostBuilder As IHostBuilder, configure As Action(Of WindowsServiceLifetimeOptions)) As IHostBuilder

参数

hostBuilder
IHostBuilder

要运行的 IHostBuilder

返回

用于链接的 hostBuilder 实例。

注解

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

适用于