【发布时间】:2020-12-11 22:15:48
【问题描述】:
将设置应用程序转换为 WiX,我在用 C# 编写的 Windows 服务应用程序中遇到以下现象:
1.) 配置具有 ServiceInstall 部分的主 EXE 组件分配 Account="LocalSystem" 应用程序将成功安装但不会运行 (-start)。它没有对将要连接的数据库进行身份验证,因此不足为奇。
2.) 使用第一项安装,我将 ValidAccount 和 ValidPassword 应用到服务属性的“登录”选项卡。像预期的那样手动完成后,服务启动并成功运行。
3.) 回到 Wix 项目,我将上述 ServiceInstall 部分更改为使用第 2 步中使用的相同 Account="ValidAccount" Password="ValidPassword" 并重建 MSI 文件。在 ServiceInstall 之后安装失败并显示以下日志消息:
InstallServices: Service:
Error 1923. Service 'My Service' (MyService.exe) could not be installed. Verify that you have sufficient privileges to install system services.
MSI (s) (B4:30) [12:54:38:616]: I/O on thread 20432 could not be cancelled. Error: 1168
MSI (s) (B4:30) [12:54:38:616]: I/O on thread 13032 could not be cancelled. Error: 1168
MSI (s) (B4:30) [12:54:38:616]: I/O on thread 10548 could not be cancelled. Error: 1168
MSI (s) (B4:30) [12:54:38:616]: I/O on thread 19688 could not be cancelled. Error: 1168
MSI (s) (B4:30) [12:54:38:616]: I/O on thread 6588 could not be cancelled. Error: 1168
MSI (s) (B4:30) [12:54:38:616]: I/O on thread 10132 could not be cancelled. Error: 1168
MSI (s) (B4:94) [12:54:38:616]: Product: MyService -- Error 1923. Service 'My Service' (MyService.exe) could not be installed. Verify that you have sufficient privileges to install system services.
4.) 我已确认 ValidAccount 是本地管理员组的成员。
5.) 我已确认 ValidAccount 已添加到“作为服务登录”策略中。
6.) 我在服务中没有 GAC 依赖项(有人认为 GAC 依赖项是在最后添加的,可能会中断安装。)
我错过了什么? ...即使是使用 LocalSystem 的无操作服务也可以。但是,如果我如下设置帐户和密码,它将无法安装。
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="TestService.exe" Guid="196BB5E5-F157-4CA2-B740-0A68E1539B7C">
<File
Id="TestService.exe"
Source="$(var.TestService.TargetPath)"
KeyPath="yes" />
<ServiceInstall
Id="TestService.exe"
Name="TestService.exe"
DisplayName="Test Service"
Description="This is a test service to test installation with WiX."
Account="myDomain\myAccount" <!-- using myAccount without the domain yields same failure -->
Password="myAccountPassword"
Arguments="-start"
Start="auto"
Interactive="yes"
Type="ownProcess"
Vital="yes"
ErrorControl="ignore" />
<ServiceControl
Id="TestService.exe"
Name="TestService.exe"
Stop="both"
Start="install"
Remove="uninstall"
Wait="no" />
</Component>
</ComponentGroup>
</Fragment>
提前致谢,
肯特
【问题讨论】: