c#服务安装卸载
- 在服务程序的是设计窗体中,点击右键“添加安装程序”,添加服务安装程序
- 将serviceProcessInstaller1->Accout属性,设为:LocalSystem(默认是User)
- 找到 Installutil.exe ,路径在:C:\Windows\Microsoft.NET\Framework\v4.0.30319
- 将Installutil.exe 复制到服务代码的 bin\Debug下
- 使用powershell,输入 .\InstallUtil.exe TestService.exe进行注册安装
- 输入 .\InstallUtil.exe /u TestService.exe 进行卸载服务
- 在任务管理器重进行启动 停止