WindowsServiceLifetimeHostBuilderExtensions.AddWindowsService Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Överlagringar
| Name | Description |
|---|---|
| AddWindowsService(IServiceCollection) |
Konfigurerar livslängden för den IHost inbyggda från |
| AddWindowsService(IServiceCollection, Action<WindowsServiceLifetimeOptions>) |
Konfigurerar livslängden för den IHost inbyggda från |
AddWindowsService(IServiceCollection)
Konfigurerar livslängden för den IHost inbyggda från services till WindowsServiceLifetime och aktiverar loggning till händelseloggen med programnamnet som standardkällnamn.
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
Parametrar
- services
- IServiceCollection
Används IServiceCollection för att skapa IHost. Till exempel, Services eller skickas IServiceCollection till återanropet ConfigureServices(Action<HostBuilderContext,IServiceCollection>) .
Returer
Instansen services för länkning.
Kommentarer
Detta är sammanhangsberoende och aktiveras endast om det upptäcker att processen körs som en Windows-tjänst.
Gäller för
AddWindowsService(IServiceCollection, Action<WindowsServiceLifetimeOptions>)
Konfigurerar livslängden för den IHost inbyggda från services till WindowsServiceLifetime och aktiverar loggning till händelseloggen med programnamnet som standardkällnamn.
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
Parametrar
- services
- IServiceCollection
Används IServiceCollection för att skapa IHost. Till exempel, Services eller skickas IServiceCollection till återanropet ConfigureServices(Action<HostBuilderContext,IServiceCollection>) .
- configure
- Action<WindowsServiceLifetimeOptions>
En Action<T> för att konfigurera den angivna WindowsServiceLifetimeOptions.
Returer
Instansen services för länkning.
Kommentarer
Detta är sammanhangsberoende och aktiveras endast om det upptäcker att processen körs som en Windows-tjänst.