feat: Add Windows Service hosting support
- Add Microsoft.Extensions.Hosting.WindowsServices package - Add HostingOptions:UseWindowsService configuration flag to appsettings.json - Configure Program.cs to optionally run as Windows Service based on config - IIS hosting continues to work by default (UseWindowsService=false) - Delete obsolete Worker.cs that was conflicting with ProfileManager
This commit is contained in:
@@ -7,6 +7,12 @@ using Microsoft.Data.SqlClient;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Configure Windows Service hosting if enabled
|
||||
if (builder.Configuration.GetValue<bool>("HostingOptions:UseWindowsService"))
|
||||
{
|
||||
builder.Host.UseWindowsService();
|
||||
}
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddHostedService<ProfileManager>();
|
||||
|
||||
Reference in New Issue
Block a user