• 以管理员身份启动命令提示符(也就是常说的cmd)

安装/卸载 Windows Service

  • 安装和卸载时我们都需要用到微软提供的工具InstallUtil.exe

一般在C:\Windows\Microsoft.NET\Framework目录下,如图:

安装/卸载 Windows Service

 大家可以从这些文件夹中寻找InstallUtil.exe程序,系统差异会导致文件夹不同,请注意分辨!

  • 安装

在打开的cmd中输入 C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe path\TestWindowsService.exe

注:path为需要安装服务的路径

如果有杀毒软件提示,请选择允许!!!

安装/卸载 Windows Service

安装/卸载 Windows Service

  •  卸载

在打开的cmd中输入 C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe /u path\TestWindowsService.exe

注:path为需要安装服务的路径

比安装命令多了/u

安装/卸载 Windows Service

 安装/卸载 Windows Service

  • 启动服务命令

ServiceName就是服务中显示的名字

net start ServiceName 

  • 停止服务命令

ServiceName就是服务中显示的名字

net stop ServiceName

  • 安装与卸载的服务可以在“服务”程序中查看(安装卸载后需要手动刷新页面)

安装/卸载 Windows Service

 

相关文章:

  • 2021-06-22
  • 2021-10-12
  • 2021-08-15
  • 2021-05-20
  • 2021-06-08
  • 2021-12-19
  • 2022-02-25
  • 2022-12-23
猜你喜欢
  • 2021-09-13
  • 2022-12-23
  • 2021-08-07
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案