1、引入
包:Microsoft.Extensions.Hosting.WindowsServices
参考:https://devblogs.microsoft.com/ifdef-windows/creating-a-windows-service-with-c-net5/
代码:UseWindowsService
2、安装
sc create XXXService BinPath=E:dirxxx.exe
3、目录
当前目录为C:WindowsSystem32
需通过注册表或其他途径获取程序运行目录
4、错误排查
进入控制面板-管理工具-事件查看器