安装Windows服务错误:无法在计算机上打开服务控制管理器。此操作可能需要其他权限

时间:2014-07-09 09:10:28

标签: windows-services installutil

我有Windows 8 我有一个使用c#和Visual Studio 2013的Windows应用程序,并希望安装此应用程序。

我打开命令提示符写:

c:\..\instalutil.exe c:\projectfolder\filename.exe

运行此代码后,它给出了错误:

An exception occured during the Install phase.
System.InvalidOperationException: Cannot open Service Control Manager on computer '.'. This operation might require other privileges.
The inner exception System.ComponentModel.Win32Exception was thrown with the following error message: Access is denied.

这是我的电脑我不知道它为什么需要访问权限?我不知道如何给予正确的特权。

我也将我的sercviceProcessInstaller帐户属性更改为LocalSystem,并尝试使用LocalService,但它们都给了我同样的错误。

我应该怎样做才能获得正确的特权?

2 个答案:

答案 0 :(得分:21)

我终于找到了答案:

  

解决方案:RUN COMMAND PROMPT AS ADMINISTRATOR

答案 1 :(得分:0)

在我的情况下,我自己遇到了这个问题,因为我无法以管理员身份从.exe文件中显式运行“Visual Studio的开发人员命令提示符”,并创建了一个快捷方式,使用“Tools =&gt ;外部工具“。 为了解决这个问题,我尝试以管理员身份运行Visual Studio,它也可以运行。

似乎Visual Studio程序不需要访问权来执行操作。