我有一个非常简单的 WiX 项目。没有什么花哨。当尝试对现有安装执行 MajorUpgrade 时,无法启动服务,并且不可避免地会回滚到以前的版本并正常启动服务。我已经删除了Start="install"
并成功手动启动应用程序,所以我知道这不是依赖问题。
我无休止地搜索,但没有找到我的问题的答案。
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." Schedule="afterInstallFinalize" />
我的服务安装:
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Name="LsdnService"
DisplayName="Lsdn Service"
Description="Placeholder for now."
Start="auto"
Account="[SERVICEACCOUNT]"
Password="[SERVICEPASSWORD]"
ErrorControl="normal"/>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="LsdnService" Wait="yes" />
我将 MSI 日志转储到一个文件中并收到此错误,但它非常模糊。
MSI (s) (18:48) [22:41:27:349]: Note: 1: 2205 2: 3: Error
MSI (s) (18:48) [22:41:27:349]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1920
安装过程中会有一些注册表修改。安装程序尝试从注册表中读取并继承已存在的值。
<Property Id="LSDNADDRESS" Value="127.0.0.1">
<RegistrySearch Id="LsdnAddressProperty" Root="HKLM" Key="$(var.RegistryKey)" Name="LsdnAddress" Type="raw" />
</Property>
<Property Id="LSDNPORT" Value="9920">
<RegistrySearch Id="LsdnPortProperty" Root="HKLM" Key="$(var.RegistryKey)" Name="LsdnPort" Type="raw" />
</Property>
<Property Id="LSDNKEY" Value="6f380b07-0b54-4904-8303-95d1ec45d453">
<RegistrySearch Id="LsdnKeyProperty" Root="HKLM" Key="$(var.RegistryKey)" Name="LsdnKey" Type="raw" />
</Property>
调试结果:经过大量调试(由原始海报 - OP),这被证明是此处描述的已知 MSI 问题:https://wix-users.narkive.com/EMfQPDrM/a-bug-get-reg-sz-when-using-type-integer https://wix-users.narkive.com/EMfQPDrM/a-bug-get-reg-sz-when-using-type-integer。很好的搜索工作。
DWORD 中包含什么? (a REG_SZ
显然):本质上MSI“转换”DWORD
通过a找到的值RegistrySearch
对格式化字符串的操作 -REG_SZ
- 升级期间
安装(也可能涉及更多)。这导致服务
期待一个DWORD
在重大期间启动时价值会下降
升级。一个非常奇特的错误.
解决方法:可以尝试通过使服务代码能够读取两者来“解决”此问题DWORD
and REG_SZ
。
这产生了比在一个问题中解决问题更稳健的解决方案
自定义操作,因为只要代码存在,它就是“永久”修复
那里(并且代码的存在提醒其他开发人员注意
问题)。或者也许只使用REG_SZ
?
Quick Checks: Check the service password and login - obviously. Anything in the
Event Viewer? Windows Key + Tap R + eventvwr.msc
+ Enter. How to use the Event Viewer to troubleshoot problems with a Windows Service https://www.coretechnologies.com/blog/windows-services/event-viewer-troubleshoot-windows-services/. Perhaps you can try to do a folder diff on the before and after folders and see if you see something unexpected in
the config files? Naturally there will be lots of binary
differences, but check the text files (also encoding). Check the MSI log file
again and search for "value 3"
as described here: Tips For Checking MSI Log
Files https://stackoverflow.com/questions/49026782/website-is-not-getting-created-in-iis-limited-edition-of-installshield/49028367#49028367. Manually copy the new files in place and attempt to start the service via the services.msc applet
.
服务专家: Windows 服务常见问题解答 (FAQ) https://www.coretechnologies.com/WindowsServices/FAQ.html。内容似乎是最新的——至少从表面上看是这样。
这些人自称是服务专家。我不知道他们是谁
是。
看看在“错误”部分在上面的链接中。这里有一些
摘录:
- 1053:服务没有及时响应启动或控制请求 https://www.coretechnologies.com/WindowsServices/FAQ.html#Error1053
- 为什么我的 Windows 服务在重新启动后没有自动启动? https://www.coretechnologies.com/WindowsServices/FAQ.html#NotStartingAtBoot
- 1069:由于登录失败,服务未启动 https://www.coretechnologies.com/WindowsServices/FAQ.html#Error1069
通用检查表:如果以上都不起作用,也许可以尝试这些"torpedoes full spread" check-lists
(只是开始调试的想法):
- 在客户端系统中安装后桌面应用程序无法打开 https://stackoverflow.com/questions/53512998/desktop-applicaton-not-opening-after-installation-in-client-system/53530377#53530377
- Windows 应用程序启动错误异常代码:0xe0434352 https://stackoverflow.com/questions/49623588/windows-application-startup-error-exception-code-0xe0434352/49637913#49637913
通用调试:引入一些通用的调试方法。
-
自定义操作调试: WIxsharp 在控制台中调试自定义操作 https://stackoverflow.com/questions/52878332/wixsharp-debug-custom-action-in-console/52880033#52880033
-
依赖关系扫描: 哪些winform项目文件应该打包到安装程序中 https://stackoverflow.com/questions/51939079/which-winform-project-files-should-be-packed-up-into-the-installer
一些进一步的链接:
- C# 调试文件夹复制到其他位置时不会运行 exe https://stackoverflow.com/questions/48075972/c-sharp-debug-folder-when-copied-to-another-location-does-not-run-the-exe
- wix服务安装权限不够 https://stackoverflow.com/questions/51768425/wix-service-install-not-enough-permission
- WiX“服务安装”内部到底是如何工作的? https://stackoverflow.com/questions/49801518/how-exactly-does-the-wix-service-install-work-internally/49802335#49802335
- WiX 工具集 PermissionEx 问题 - 应用程序安装后无法运行 https://stackoverflow.com/questions/53354907/wix-toolset-permissionex-problem-app-does-not-run-after-installation/53364536#53364536
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)