操作于 13:56:48 结束:ServiceRestarter.返回值 3.操作结束 13:56:48:安装.返回值 3.有人可以帮我吗?编辑我使用了旧的 ServiceConfig-extension:这给了我以下构建错误:错误 CNDL0200:ServiceInstall 元素包含未处理的扩展元素util:ServiceConfig".请确保中元素的扩展'http://schemas.microsoft.com/wix/UtilExtension' 命名空间已被提供.我知道我可以通过命令行使用 -ext WixUtilExtension 来解决这个错误 - 但我想使用 Visual Studio 来构建......那么我该如何调整构建命令?>唯一的机会是在我的项目中添加对 WixUtilExtension.dll 的引用. 解决方案 我可以看到您只尝试了 MSI 5.0 附带的 ServiceConfig 元素.但是,在 UtilExtension 中有 另一个 ServiceConfig 元素,它已经存在很长时间了,似乎 它有效.util:ServiceConfig 元素包含您想要使用的 3 个参数:FirstFailureActionType、SecondFailureActionType 和 ThirdFailureActionType,都接受相同的枚举值 - none、reboot、restart 和 runCommand.尝试一下,如果它有效,它是比自定义操作更好的选择.I have following .wxs-file:<?Before that, I've tried:<CustomAction Id="ServiceRestarter" Property="QtExecCmdLine" Value='"[SystemFolder]sc.exe" failure "$(var.ProductName)" reset= 60 actions= restart/0' />which apparently called sc.exe - but changed nothing ...Before that I've tried:<ServiceInstall Id="SeviceInstall" Name="$(var.ProductName)" DisplayName="$(var.ProductName)" Type="ownProcess" Interactive="no" Start="auto" Vital="yes" ErrorControl="normal" Account="LOCALSYSTEM"> <ServiceConfig Id="ServiceConfig" DelayedAutoStart="yes" OnInstall="yes" OnReinstall="yes" OnUninstall="no" FailureActionsWhen="failedToStopOrReturnedError" /> <ServiceConfigFailureActions Id="ServiceRestarter" OnInstall="yes" OnReinstall="yes" OnUninstall="no" ResetPeriod="0"> <Failure Action="restartService" Delay="0" /> <Failure Action="restartService" Delay="0" /> <Failure Action="restartService" Delay="0" /> </ServiceConfigFailureActions></ServiceInstall>which did not work, as the MsiServiceConfigFailureActions table does not work if using an installer < 5.0, and even if using InstallerVersion="500" the only thing I get is an error:(and yes, ... I've tried InstallPrivilges="elevated" also - but ... the real issue is Action="restartService" according to )So ... using a CustomAction is the way to go (or not?).I have following output of the logCan anybody help me out?editI've used the old ServiceConfig-extension:<util:ServiceConfig which gives me a following build-error:I know that I can resolve this error by using -ext WixUtilExtension via commandline - but I want to use Visual Studio for building ... So how can I adapt the build-command?Only chance is to add a reference to WixUtilExtension.dll to my project. 解决方案 I can see that you've only tried the ServiceConfig element, which came with MSI 5.0. However, there's another ServiceConfig element in UtilExtension, which has been there for a long time and it seems that that it works.The util:ServiceConfig element contains 3 parameters you'd like to use: FirstFailureActionType, SecondFailureActionType and ThirdFailureActionType, all accepting the same enumeration of values - none, reboot, restart and runCommand.Try it out and if it works, it is far better choice than a custom action. 这篇关于如何使用 WiX 设置服务的恢复选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-10 16:16