Add Windows Service support to enable service deployment

- Add Microsoft.Extensions.Hosting.WindowsServices package (v8.0.1)
- Configure host to use Windows Service lifetime management
- Enables proper startup/shutdown when installed via Deploy-PepApi.ps1

Fixes issue where service would fail to start when deployed as Windows Service.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-27 19:22:18 -04:00
parent ab916dc82a
commit 029ad2b3ef
2 changed files with 4 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.20" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
</ItemGroup>

View File

@@ -4,6 +4,9 @@ using PepLib.Data;
var builder = WebApplication.CreateBuilder(args);
// Enable Windows Service hosting
builder.Host.UseWindowsService();
// Add services to the container
builder.Services.AddControllers()
.AddJsonOptions(options =>