首页 > 技术文章 > 无法从命令行或调试器启动服务,必须首先安装Windows服务(使用installutil.exe),然后用ServerExplorer、Windows服务器管理工具或NET START命令启动它

wyongqi 2017-10-12 10:45 原文

无法从命令行或调试器启动服务,必须首先安装Windows服务(使用installutil.exe),然后用ServerExplorer、Windows服务器管理工具或NET START命令启动它

 

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

 

推荐阅读