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

13

我有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.

这是我的电脑,我不知道为什么它需要访问权限?而且我也不知道如何授予正确的权限。

另外,我将我的serviceProcessInstaller账户属性更改为LocalSystem并尝试使用LocalService,但两者都给出了相同的错误。

我该怎么做才能给予正确的权限?

2个回答

30

我终于找到答案了:

解决方法:以管理员身份运行命令提示符


嗨,我有同样的问题。我运行了这个命令:C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe E:\DataService\DataSrvice.exe 它正常工作。 - Eqbal Sohrabi

0
我自己也遇到了这个问题,在我的情况下,由于我无法以管理员身份显式地从.exe文件运行“Visual Studio开发人员命令提示符”并创建一个快捷方式在Visual Studio内部运行它,所以我尝试以管理员身份运行Visual Studio,并且它也起作用了。
看起来是Visual Studio程序没有要求访问执行操作的权限。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接