共用方式為


WindowsServiceLifetimeHostBuilderExtensions.AddWindowsService 方法

定義

多載

AddWindowsService(IServiceCollection)

設定從 services 建置至 WindowsServiceLifetimeIHost 存留期,並啟用以應用程式名稱做為預設來源名稱的事件記錄檔。

AddWindowsService(IServiceCollection, Action<WindowsServiceLifetimeOptions>)

設定從 services 建置至 WindowsServiceLifetimeIHost 存留期,並啟用以應用程式名稱做為預設來源名稱的事件記錄檔。

AddWindowsService(IServiceCollection)

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

設定從 services 建置至 WindowsServiceLifetimeIHost 存留期,並啟用以應用程式名稱做為預設來源名稱的事件記錄檔。

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

參數

傳回

用於鏈結的 services 實例。

備註

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

適用於

AddWindowsService(IServiceCollection, Action<WindowsServiceLifetimeOptions>)

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

設定從 services 建置至 WindowsServiceLifetimeIHost 存留期,並啟用以應用程式名稱做為預設來源名稱的事件記錄檔。

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

參數

傳回

用於鏈結的 services 實例。

備註

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

適用於