【发布时间】:2014-03-27 01:22:27
【问题描述】:
我创建了一个 Windows 服务,它添加和修改注册表项值。 Wix 安装并成功启动服务,但没有发生修改注册表项的操作,当我以管理员帐户手动启动服务时,服务运行正常。当我转到开始>管理工具>服务并右键单击我的服务,然后在属性上,然后在登录选项卡上,提供管理员帐户和密码,然后服务运行并添加,成功修改注册表值。但是如果我使用wix安装程序安装它,它会安装并成功启动,但服务无法修改注册表项值,可能是它需要管理员权限才能正常工作。
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" AdminImage="yes" InstallPrivileges="elevated" />
<Component Id ="MyServiceInstaller" Guid="{35FB6173-9484-48CA-BA86-30B0A68B301D}">
<File Id="MyNewService.exe" Name="MyNewService.exe" Source="MyNewService.exe" Vital="yes" KeyPath="yes" DiskId="1"/>
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="abcService"
DisplayName="abc Service"
Description="Monitoring and management service "
Start="auto"
Account="LocalMachine"
ErrorControl="ignore"
Interactive="no">
</ServiceInstall>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="AbcService" Wait="yes" />
</Component>
请指导我, 谢谢。
【问题讨论】:
-
Administration 是属于 Administrators 组的有效 Windows 用户名吗?您是否尝试过在 ServiceInstall xml 中输入密码?
-
在理想情况下,服务会在某处报告它无法更新注册表的原因。假设它实际上是那个管理帐户,除非提供密码,否则它将无法工作。如果凭据不正确,我希望该服务在安装过程中启动失败,这可能是您手动添加密码的原因。
-
@PhilDW 管理员不正确,问题是修改实际值为 LocalMachine,服务在做什么,是添加和修改 HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\ Internet Settings\ 密钥,当我在服务属性中设置凭据时,它会修改密钥,否则它不会修改密钥,wix 或服务中是否有任何选项,因此我不应该手动提供凭据。谢谢。