WindowsServiceLifetimeHostBuilderExtensions.AddWindowsService 方法

定义

重载

AddWindowsService(IServiceCollection)

配置从 services 生成到 WindowsServiceLifetimeIHost 的生存期,并启用使用应用程序名称作为默认源名称登录到事件日志。

AddWindowsService(IServiceCollection, Action<WindowsServiceLifetimeOptions>)

配置从 services 生成到 WindowsServiceLifetimeIHost 的生存期,并启用使用应用程序名称作为默认源名称登录到事件日志。

AddWindowsService(IServiceCollection)

Source:
WindowsServiceLifetimeHostBuilderExtensions.cs
Source:
WindowsServiceLifetimeHostBuilderExtensions.cs

配置从 services 生成到 WindowsServiceLifetimeIHost 的生存期,并启用使用应用程序名称作为默认源名称登录到事件日志。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddWindowsService(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddWindowsService (this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
static member AddWindowsService : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddWindowsService (services As IServiceCollection) As IServiceCollection

参数

返回

用于链接的 services 实例。

注解

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

适用于

AddWindowsService(IServiceCollection, Action<WindowsServiceLifetimeOptions>)

Source:
WindowsServiceLifetimeHostBuilderExtensions.cs
Source:
WindowsServiceLifetimeHostBuilderExtensions.cs

配置从 services 生成到 WindowsServiceLifetimeIHost 的生存期,并启用使用应用程序名称作为默认源名称登录到事件日志。

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

参数

返回

用于链接的 services 实例。

注解

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

适用于