尝试在 Windows 2012 服务器上安装 Windows 服务时 InstallUtil 抛出异常

标签 installutil

我使用 VS 2010(32 位)开发了一个 Windows 服务,但为“任何 CPU”编译了它。

我已将所需的 exe 和其他文件传输到 Windows 2012 Server(标准版 - 64 位),现在我正在尝试使用 InstallUtil 安装它

我已将命令提示符下的路径更改为“C:\Windows\Microsoft.NET\Framework64\v4.0.30319”,然后运行命令

InstallUtil "D:\MyPath\MyService.exe"

但是安装失败并出现错误

    An exception occurred during the Install phase.
    System.Security.SecurityException: The source was not found, 
but some or all event logs could not be searched.  
Inaccessible logs: Security.

我试过以管理员身份运行 InstallUtil。服务器没有 Visual Studio 命令提示符。

我该如何解决这个问题?

最佳答案

我认为它应该带有扩展名 (.exe) 而没有引号。它是:

InstallUtil.exe D:\MyPath\MyService.exe

如果您在“Windows PowerShell”中,则应添加“/.”。它是:

./InstallUtil.exe C:\ServicesExample\Services.MyService.exe

一旦你打开:C:\Windows\Microsoft.NET\Framework\v4.0.30319 并以管理员身份运行。

关于尝试在 Windows 2012 服务器上安装 Windows 服务时 InstallUtil 抛出异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21860241/

相关文章:

c# - 安装 util 在错误的文件夹上查找服务

c# - 使用 InstallUtil 安装带有启动参数的 Windows 服务

batch-file - 使用ERRORLEVEL检索InstallUtil的退出状态

c# - Windows服务启动时如何运行任务?

syntax - 正确的 InstallUtil 文件语法路径?

c# - WCF 服务作为 Windows 服务问题 (Windows 7)

如果 C# Windows 服务包含(嵌入) Entity Framework ,则不会安装

c# - 如何调试自定义 Windows 服务的安装?

c# - 安装不带 InstallUtil.exe 的 .NET Windows 服务

windows - 在服务器上安装同一 Windows 服务的多个实例