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