我在 Wix 中有自定义操作来为我的应用程序安装其中一项服务。
<Custom Action='ManagedInstall' After="InstallFinalize"/>
<CustomAction Id="ManagedInstall"
Directory='INSTALLDIR'
ExeCommand='"[WindowsFolder]\Microsoft.NET\Framework\v2.0.50727\installUtil.exe" /LogToConsole=false ControlService.dll'
Impersonate='yes'
Return='check'>
</CustomAction>
这适用于 Windows XP 和 7(提升 UAC)任何台式机、虚拟机或笔记本电脑,除了我们的一些带加密的笔记本电脑。
假设这是因为 installUtil.exe 控制台执行被加密中断(由于某种原因,这是系统之间发现的唯一区别),正在尝试解决此替换上述自定义操作代码的解决方案。
<Component Id='ControlServiceDLL' Guid='27C58A4E-E1A9-4b85-B048-F8BBB1BF3C76'>
<File Id='ControlService.dll'
Name='ControlService.dll'
DiskId='1'
Source='Data\ControlService.dll'
Vital='yes'
KeyPath='yes'/>
<ServiceInstall
Id="ControlServiceInstall"
Type="shareProcess"
Vital='yes'
Name='ControlService'
DisplayName='Control Service'
Description='Control Service Description'
Start="demand"
ErrorControl='ignore'
Interactive="no">
</ServiceInstall>
<ServiceControl Id="StartService" Remove="uninstall" Name="Control Service" Wait="yes" />
</Component>
它最初无法启动,所以我不得不删除服务控制启动/停止命令以查看它是否安装。是的,它安装得很好,但甚至无法手动启动服务。
通过观察发现以下内容可能有助于有人尝试帮助我。
比较我在下面找到的 2 种不同方法的服务属性 希望它对可以回答我的问题的人有所帮助。
通过使用自定义操作:Service Properties Executable Path 显示,C:\windows\SysWOW64\dllhost.exe /Processid:{926E3CF4-B966-4E61-A46B-C3C49F579F7C}
在使用 Service Install 时,它显示“C:\Program Files (x86)\My Test Company\Services\ControlService.dll”