WindowsServiceLifetimeHostBuilderExtensions.UseWindowsService 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
UseWindowsService(IHostBuilder) |
将主机生存期设置为 WindowsServiceLifetime,并使用应用程序名称作为默认源名称登录到事件日志。 |
UseWindowsService(IHostBuilder, Action<WindowsServiceLifetimeOptions>) |
将主机生存期设置为 WindowsServiceLifetime,并使用应用程序名称作为默认源名称登录到事件日志。 |
UseWindowsService(IHostBuilder)
将主机生存期设置为 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>)
将主机生存期设置为 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。
- configure
- Action<WindowsServiceLifetimeOptions>
返回
用于链接的 hostBuilder
实例。
注解
这是上下文感知的,仅当它检测到进程作为 Windows 服务运行时才会激活。