.net - Windows 安装程序 : Error 1001, CustomAction _xxxxx.install 返回实际错误代码 1603

标签 .net windows-services windows-installer installshield-2012

问题:

我已经使用 Visual Studio 2012 和 InstallShield 创建了一个 Windows 服务安装程序。

服务运行良好。
安装程序在我的开发机器(Windows 8 64 位)和我的 XP 虚拟机(32 位)上运行良好。

但在 Windows Server 2008 R2 上,相同的安装程序会出现“错误 10001”。
没有任何进一步的信息。

事件日志中包含以下信息:

Product: DbBackupServiceSetup -- Error 1001. 
(NULL)
(NULL)
(NULL)
(NULL)
(NULL)

the message resource is present but the message is not found in the string/message table

如果我手动安装:

C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "D:\Program Files\Test\DbBackupService.exe"

然后它甚至在 Windows Server 2008 R2 上也能正常工作...

我已经创建了一个具有 32 位可执行文件的安装程序和一个具有 64 位可执行文件的安装程序,但我在两者上都收到此错误...

我试过在启用日志记录的情况下执行 msi

msiexec /i "D:\Install\DISK1\DbBackupServiceSetup.msi" /Lv "D:\example.log"

日志文件中第一个错误指示在这里:

Created Custom Action Server with PID 3932 (0xF5C).
MSI (s) (C0:74) [14:26:28:065]: Running as a service.
MSI (s) (C0:74) [14:26:28:080]: Hello, I'm your 32bit Elevated custom action server.
MSI (s) (C0!14) [14:26:33:681]: 
MSI (s) (C0:E8) [14:26:33:681]: Leaked MSIHANDLE (16) of type 790531 for thread 3348
MSI (s) (C0:E8) [14:26:33:681]: Note: 1: 2769 2: _B384C869AD7BC0C39F5780609620645B.install 3: 1 
Info 2769. Custom Action _B384C869AD7BC0C39F5780609620645B.install did not close 1 MSIHANDLEs.
CustomAction _B384C869AD7BC0C39F5780609620645B.install returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 14:26:33: InstallFinalize. Return value 3.
MSI (s) (C0:F0) [14:26:33:697]: User policy value 'DisableRollback' is 0
MSI (s) (C0:F0) [14:26:33:697]: Machine policy value 'DisableRollback' is 0

我不明白。
完全相同的安装程序在其他机器上运行良好。
所有自定义操作都包含在 try-catch 中,系统帐户对文件系统具有完全访问权限,并且它不是网络共享。
并且使用 installutil 安装服务是有效的,所以它一定是安装程序本身的错误。

对我来说,它看起来像是在呼唤

C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe "D:\Program Files\test\DbBackupService.exe"

代替

C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "D:\Program Files\test\DbBackupService.exe"

因此得到坏图像异常。

但是,如果是这样的话,我不明白的是为什么我同时使用 32 位和 64 位可执行文件时会出现此错误...

按理说是InstallShield本身的问题...
哦,我正在使用远程桌面(mstsc.exe)连接到服务器,以防万一,我无法直接访问服务器,所以如果是 mstsc 问题,我无法尝试。

最佳答案

错误代码 1001 始终 表示安装程序类自定义操作失败。 InstallShield 只是按照您的指示使用/托管它。安装程序类自定义操作非常脆弱并且会耗尽进程,因此您获得的日志记录非常少。

您不应使用自定义操作,而应使用 InstallShield 在高级组件设置下公开的 native Windows Installer ServiceInstall 和 ServiceConfigure 表。创建一个组件,将您的服务 EXE 作为 key 文件添加到其中,然后定义服务元数据。

首先,我建议只创建安装,然后在安装后手动启动它。一旦工作正常,请添加 ServiceControl 信息,以便安装程序自动执行。冲洗并在 VM 上重复。

如果您在安装程序尝试启动服务时遇到错误 1920,则这始终是服务问题。分析它以了解问题,然后修复代码或修复安装程序(如果它缺少依赖项)。

关于.net - Windows 安装程序 : Error 1001, CustomAction _xxxxx.install 返回实际错误代码 1603,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16693048/

相关文章:

windows - Windows XP 服务什么时候启动?

windows-services - MSDeploy安装windows服务?

windows-installer - 如何使用 Inno Setup 创建 MSI 安装程序?

windows - 自动运行 CD 上的 MSI 文件

c# - C# if/else 上的编译器优化

.net - 使用 .net 库自动执行任务的最佳技术是什么?

c++ - 内存分配问题

c# - ViewModel 属性在 HttpPost 上保持为 null

c# - 如何在 C# 中读取 (Google.Apis.Drive.v3.Data.File)?

WiX 安装程序会在卸载时删除文件,但不会在升级时删除文件