Deli z drugimi prek


WindowsServiceLifetimeHostBuilderExtensions.AddWindowsService Method

Definition

Overloads

AddWindowsService(IServiceCollection)

Configures the lifetime of the IHost built from services to WindowsServiceLifetime and enables logging to the event log with the application name as the default source name.

AddWindowsService(IServiceCollection, Action<WindowsServiceLifetimeOptions>)

Configures the lifetime of the IHost built from services to WindowsServiceLifetime and enables logging to the event log with the application name as the default source name.

AddWindowsService(IServiceCollection)

Source:
WindowsServiceLifetimeHostBuilderExtensions.cs
Source:
WindowsServiceLifetimeHostBuilderExtensions.cs

Configures the lifetime of the IHost built from services to WindowsServiceLifetime and enables logging to the event log with the application name as the default source name.

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

Parameters

Returns

The services instance for chaining.

Remarks

This is context aware and will only activate if it detects the process is running as a Windows Service.

Applies to

AddWindowsService(IServiceCollection, Action<WindowsServiceLifetimeOptions>)

Source:
WindowsServiceLifetimeHostBuilderExtensions.cs
Source:
WindowsServiceLifetimeHostBuilderExtensions.cs

Configures the lifetime of the IHost built from services to WindowsServiceLifetime and enables logging to the event log with the application name as the default source name.

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

Parameters

Returns

The services instance for chaining.

Remarks

This is context aware and will only activate if it detects the process is running as a Windows Service.

Applies to