How to use Worker Service in Windows

When we try to create a Worker Service project in Windows, do not forget to change depandency to Microsoft.Extensions.Hosting.WindowsServices

This platform is setting to package IHosting by default.

We need to change the refering package to WindowsServices, then add an new implement in Programs.cs

DO NOT FORGET ADD UseWindowsService() to support framework in windows system.

public static IHostBuilder CreateHostBuilder(string[] args) =>
        .ConfigureServices((hostContext, services) =>

Leave a Comment