C#开发windows服务程序
Program.cs Main
ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new SocketServer() }; ServiceBase.Run(ServicesToRun);
双击Windows服务文件,右击“添加安装程序”
OnStart启动服务
服务配置
cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
InstallUtil.exe XXX.exe 回车
卸载,打开cmd, 直接输入 sc delete WinServiceTest便可。
win2016注意:
参考:
https://jingyan.baidu.com/article/59703552fee38f8fc107405c.html
https://jingyan.baidu.com/article/fa4125acb71a8628ac709226.html