共用方式為


WindowsServiceLifetimeHostBuilderExtensions.UseWindowsService 方法

定義

多載

UseWindowsService(IHostBuilder)

將主機存留期設定為 WindowsServiceLifetime,並啟用以應用程式名稱做為預設來源名稱的事件記錄檔。

UseWindowsService(IHostBuilder, Action<WindowsServiceLifetimeOptions>)

將主機存留期設定為 WindowsServiceLifetime,並啟用以應用程式名稱做為預設來源名稱的事件記錄檔。

UseWindowsService(IHostBuilder)

來源:
WindowsServiceLifetimeHostBuilderExtensions.cs
來源:
WindowsServiceLifetimeHostBuilderExtensions.cs
來源:
WindowsServiceLifetimeHostBuilderExtensions.cs
來源:
WindowsServiceLifetimeHostBuilderExtensions.cs

將主機存留期設定為 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>)

來源:
WindowsServiceLifetimeHostBuilderExtensions.cs
來源:
WindowsServiceLifetimeHostBuilderExtensions.cs
來源:
WindowsServiceLifetimeHostBuilderExtensions.cs
來源:
WindowsServiceLifetimeHostBuilderExtensions.cs

將主機存留期設定為 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

傳回

用於鏈結的 hostBuilder 實例。

備註

這是內容感知,只有在偵測到進程以 Windows 服務身分執行時才會啟動。

適用於