WindowsServiceLifetimeHostBuilderExtensions Class

Definition

Extension methods for setting up WindowsServiceLifetime.

C#
public static class WindowsServiceLifetimeHostBuilderExtensions
Inheritance
WindowsServiceLifetimeHostBuilderExtensions

Methods

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)

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.

UseWindowsService(IHostBuilder, Action<WindowsServiceLifetimeOptions>)

Sets the host lifetime to WindowsServiceLifetime and enables logging to the event log with the application name as the default source name.

UseWindowsService(IHostBuilder)

Sets the host lifetime to WindowsServiceLifetime and enables logging to the event log with the application name as the default source name.

Applies to

Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)