安装/卸载windows服务

发布时间 2024-01-10 18:04:17作者: csjoz11

1.以管理员身份运行cmd

2.安装windows服务

  cd C:\Windows\Microsoft.NET\Framework\v4.0.30319(InstallUtil.exe的路径,注意InstallUtil.exe的版本号需要和项目的版本号相同)

3.安装windows服务

  InstallUtil.exe F:\TestApp\WindowsService1\WindowsService1\bin\Debug\WindowsService1.exe(项目的路径)

 

4.启动windows服务

  net start  Service1(服务名称) 或运行cmd输入:

services.msc 找到对应的服务启动

 

 

 

卸载windows服务

  InstallUtil.exe /u  F:\TestApp\WindowsService1\WindowsService1\bin\Debug\WindowsService1.exe