WIX:Windows服务修复由于权限不足而失败+如何检测修复模式? [英] WIX: Windows Service Repair failing on lack of permissions + how to detecting repair mode?

查看:66
本文介绍了WIX:Windows服务修复由于权限不足而失败+如何检测修复模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在通过自定义UI对话框询问登录帐户后,我们的WIX安装程序会安装Windows服务.安装成功后,该服务将启动.整个设置需要提升的权限.

Our WIX setup installs a windows service after asking logon account through a custom UI dialog.. The service starts after installation succeeds. Entire setup requires elevated privileges.

希望找到有关几个问题的任何提示:

Hoping for any pointers regarding couple of questions:

问题1 在尝试从添加/删除程序"中进行修复"时,UAC会提示特权提升.允许之后,修复仍然失败,并显示以下消息:

Question 1 On attempting "Repair" from "Add/Remove Programs", UAC prompts for privilege elevation. After allowing so, the repair still fails with message:

无法安装服务.请确认您具有足够的特权来安装系统服务".

"Service could not be installed. Verify that you have sufficient privileges to install system services".

以下是代码摘录:

...

特权...

  <Component Id="C_ServiceEXE" Guid="{105F9C86-BF07-43C8-8C78-DF30F012CD68}">
    <File Id="$(var.TargetFileName)" Name="$(var.TargetFileName)" KeyPath="yes"  Assembly=".net"
          AssemblyManifest="$(var.TargetFileName)" AssemblyApplication="$(var.TargetFileName)" DiskId="1"
          Source="$(var.TargetDir)\$(var.TargetFileName)" />

    <Condition>Privileged</Condition>

    <ServiceInstall Id="Id_ServiceInstall"
                     Name ="$(var.ServiceName)"
                     Description="$(var.ServiceDescription)"
                     DisplayName="$(var.ServiceName)"
                     Account="[SERVICEACCOUNT]"
                     Password="[SERVICEPASSWORD]"
                     Start="auto"
                     ErrorControl="normal"
                     Type="ownProcess"
                     Vital="yes"
                     Interactive="no"
                     />

    <ServiceControl Id="Id_ServiceControl"
                    Name ="$(var.ServiceName)"
                     Remove="uninstall"
                     Start="install"
                     Stop="both"
                     Wait="yes"
                    />

  </Component>

...

我不太确定为什么会这样,因为我的管理员在我的Win7开发箱中,并且已经标记了安装程序,特别是将服务安装组件标记为在特权模式下运行.

I not quite sure why this is happening, since I admin am on on my Win7 dev box and have marked both the setup and speicifically the service install component to be run in privileged mode.

我怀疑我可能在AdminInstallExecute序列中缺少调度修复,但不确定是否能解决此问题.

I suspect I might be missing scheduling repair inside an AdminInstallExecute sequence but not quite sure if that will fix this.

问题2 另外,相关的问题是-如果修复成功,是否会再次要求用户通过UI输入登录帐户.我宁愿在修复或升级期间禁止所有交互式UI.我意识到,使用UPGRADINGPRODUCTCODE可以检测到升级.

Question 2 Also, related question is - if repair does succeed, would it again require user to enter logon account via the UI. I'd rather suppress all interactive UIs during repair or upgrade. I realize that UPGRADINGPRODUCTCODE to detect upgrade.

但是如何检测到维修?

感谢所有帮助或指示.

推荐答案

维护模式最有可能失败,因为您的服务用户帐户无权使用

Maintenance mode most likely fails because your service user account doesn't have the right to log on as a service. It doesn't matter if you are an Administrator, you cannot install services for an user without giving him the log on right.

如果设置此策略有效,则还需要在安装过程中动态地进行设置.一种解决方案是使用 ntrights.exe 作为自定义操作.此自定义操作可以使用包含用户帐户信息的自定义属性.

If setting this policy works, you also need to do it dynamically during install. A solution is to use ntrights.exe as a custom action. This custom action can use your custom properties which contains the user account information.

要检测修复过程,可以检查重新安装属性值.

To detect a repair process, you can check the REINSTALL property value.

这篇关于WIX:Windows服务修复由于权限不足而失败+如何检测修复模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆