WindowsServiceLifetimeHostBuilderExtensions.UseWindowsService 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
UseWindowsService(IHostBuilder) |
將主機存留期設定為 WindowsServiceLifetime,並啟用以應用程式名稱做為預設來源名稱的事件記錄檔。 |
UseWindowsService(IHostBuilder, Action<WindowsServiceLifetimeOptions>) |
將主機存留期設定為 WindowsServiceLifetime,並啟用以應用程式名稱做為預設來源名稱的事件記錄檔。 |
UseWindowsService(IHostBuilder)
將主機存留期設定為 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>)
將主機存留期設定為 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。
- configure
- Action<WindowsServiceLifetimeOptions>
傳回
用於鏈結的 hostBuilder
實例。
備註
這是內容感知,只有在偵測到進程以 Windows 服務身分執行時才會啟動。