Microsoft.Extensions.Hosting.WindowsServices 9.0.0-preview.3.24172.9
About
Supports using Windows Services with the hosting infrastructure.
Key Features
- Can configure a host to be a Windows Service.
How to Use
From a Worker Service app created using the Visual Studio template:
IHost host = Host.CreateDefaultBuilder(args)
.ConfigureServices(services =>
{
services.AddHostedService<Worker>();
})
// Configure as a Windows Service
.UseWindowsService(options =>
{
options.ServiceName = "My Service";
})
.Build();
host.Run();
Main Types
The main types provided by this library are:
Microsoft.Extensions.Hosting.WindowsServiceLifetimeHostBuilderExtensions
Microsoft.Extensions.Hosting.WindowsServices.WindowsServiceLifetime
Additional Documentation
- WindowsServiceLifetime
- WindowsServiceLifetimeHostBuilderExtensions
- Create Windows Service using BackgroundService
- Host ASP.NET Core in a Windows Service
Related Packages
Microsoft.Extensions.Hosting
System.ServiceProcess.ServiceController
Feedback & Contributing
Microsoft.Extensions.Hosting.WindowsServices is released as open source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.
No packages depend on Microsoft.Extensions.Hosting.WindowsServices.
https://go.microsoft.com/fwlink/?LinkID=799421
.NET Framework 4.6.2
- Microsoft.Extensions.Hosting (>= 9.0.0-preview.3.24172.9)
- Microsoft.Extensions.Logging.EventLog (>= 9.0.0-preview.3.24172.9)
.NET Standard 2.1
- System.ServiceProcess.ServiceController (>= 9.0.0-preview.3.24172.9)
- Microsoft.Extensions.Logging.EventLog (>= 9.0.0-preview.3.24172.9)
- Microsoft.Extensions.Hosting (>= 9.0.0-preview.3.24172.9)
.NET Standard 2.0
- System.ServiceProcess.ServiceController (>= 9.0.0-preview.3.24172.9)
- Microsoft.Extensions.Hosting (>= 9.0.0-preview.3.24172.9)
- Microsoft.Extensions.Logging.EventLog (>= 9.0.0-preview.3.24172.9)
.NET 9.0
- System.ServiceProcess.ServiceController (>= 9.0.0-preview.3.24172.9)
- Microsoft.Extensions.Hosting (>= 9.0.0-preview.3.24172.9)
- Microsoft.Extensions.Logging.EventLog (>= 9.0.0-preview.3.24172.9)
.NET 8.0
- System.ServiceProcess.ServiceController (>= 9.0.0-preview.3.24172.9)
- Microsoft.Extensions.Logging.EventLog (>= 9.0.0-preview.3.24172.9)
- Microsoft.Extensions.Hosting (>= 9.0.0-preview.3.24172.9)