Delen via


WindowsServiceLifetimeHostBuilderExtensions.UseWindowsService Method

Definition

Overloads

UseWindowsService(IHostBuilder)

Sets the host lifetime 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)

Source:
WindowsServiceLifetimeHostBuilderExtensions.cs
Source:
WindowsServiceLifetimeHostBuilderExtensions.cs

Sets the host lifetime 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::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

Parameters

hostBuilder
IHostBuilder

The IHostBuilder to operate on.

Returns

The hostBuilder 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

UseWindowsService(IHostBuilder, Action<WindowsServiceLifetimeOptions>)

Source:
WindowsServiceLifetimeHostBuilderExtensions.cs
Source:
WindowsServiceLifetimeHostBuilderExtensions.cs

Sets the host lifetime 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::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

Parameters

hostBuilder
IHostBuilder

The IHostBuilder to operate on.

Returns

The hostBuilder 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