我想安装并启动Redis (for Windows)作为我们软件包的一部分。服务的安装和启动工作正常,但在安装过程中会发生错误,然后是回滚,而服务在回滚后不会被删除。
有人能帮我找出我做错了什么吗?另外,我是否也需要单独的删除命令,还是回滚也适用于卸载?
(像#fil5E85DBB2FFC8A8CFA55EDCADD8376C1F这样的值是使用HeatDirectory为redis-server.exe及其目录生成的Id)
<!--Install Redis-->
<CustomAction Id="SetRedisInstall"
Property="RedisInstall"
Value=""[#fil5E85DBB2FFC8A2CFA55EDCADD8376C1F]" --service-install "[dir13BD3F7531FC8E0F30BB51FAA1B1357F]redis.windows.conf" --loglevel verbose" />
<CustomAction Id="RedisInstall"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Execute="deferred"
Return="check"
Impersonate="no"/>
<CustomAction Id="SetRedisStart" Property="RedisStart" Value=""[#fil5E85DBB2FFC8A2CFA55EDCADD8376C1F]" --service-start" />
<CustomAction Id="RedisStart"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Execute="deferred"
Return="check"
Impersonate="no"/>
<!--Rollback Redis-->
<CustomAction Id="SetRedisStop" Property="RedisStop" Value=""[#fil5E85DBB2FFC8A2CFA55EDCADD8376C1F]" --service-stop" />
<CustomAction Id="RedisStop"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Execute="rollback"
Return="ignore"
Impersonate="no"/>
<CustomAction Id="SetRedisRemove" Property="RedisRemove" Value=""[#fil5E85DBB2FFC8A2CFA55EDCADD8376C1F]" --service-uninstall" />
<CustomAction Id="RedisRemove"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Execute="ignore"
Return="asyncWait"
Impersonate="no"/>
<InstallExecuteSequence>
<!--Install Redis-->
<Custom Action="RedisInstall" Before="InstallFinalize">Not Installed</Custom>
<Custom Action="SetRedisInstall" Before="RedisInstall">Not Installed</Custom>
<Custom Action="RedisStart" After="RedisInstall">Not Installed</Custom>
<Custom Action="SetRedisStart" Before="RedisStart">Not Installed</Custom>
<!--Rollback Redis-->
<Custom Action="SetRedisStop" Before="RedisStop"></Custom>
<Custom Action="RedisStop" Before="RedisStart"></Custom>
<Custom Action="RedisRemove" Before="RedisInstall"></Custom>
<Custom Action="SetRedisRemove" Before="RedisRemove"></Custom>
</InstallExecuteSequence>编辑我有这个组件
<Feature Id="Redis" Title="Redis" Level="1" >
<ComponentGroupRef Id="RedisWxs"/>
</Feature>现在服务部分也是:
<ServiceInstall Id="siRedisService" Description="Redis Service" DisplayName="Redis" Arguments=""[dir13BD3F7531FC8E0F30BB51FAA1B1357F]redis.windows.conf"" ErrorControl="normal" Name="Redis" Start="auto" Type="ownProcess" Vital="yes" Account="NT AUTHORITY\NetworkService"/>
<ServiceControl Id="scRedisService" Name="Redis" Start="install" Stop="both" Remove="both" Wait="yes" />如何将服务添加到现有组件中?
编辑2
我已经禁用了自动采集和编辑输出文件,以解决引用问题。我仍然有一个问题,那就是Redis服务无法启动。但是,当我将路径(包括配置文件)复制到cmd中时,它的工作非常好……
这是密码
<Component Id="cmp911C50BAA696496834114926A958787D" Guid="*">
<File Id="fil5E85DBB2FFC8A2CFA55EDCADD8376C1F" KeyPath="yes" Source="$(var.RedisPath)\redis-server.exe" />
<ServiceInstall Id="siRedisService" DisplayName="Redis" Arguments="--service-run redis.windows.conf --loglevel verbose" ErrorControl="normal" Name="Redis" Start="auto" Type="ownProcess" Vital="yes" Account="NT AUTHORITY\NetworkService"/>
<ServiceControl Id="scRedisService" Name="Redis" Start="install" Stop="both" Remove="both" Wait="yes" />
</Component>
<Component Id="cmpFC38C2953561FABFFCF29CCEC52692E1" Guid="*">
<File Id="filF5607FB03CD4B203C699DA14D17FF53B" KeyPath="yes" Source="$(var.RedisPath)\redis.windows.conf" />
</Component>编辑3-工作解决方案
有一个许可问题,我就是这样解决的:
<Component Id="cmp911C50BAA696496834114926A958787D" Guid="*">
<File Id="fil5E85DBB2FFC8A2CFA55EDCADD8376C1F" KeyPath="yes" Source="$(var.RedisPath)\redis-server.exe" />
<CreateFolder Directory="dir13BD3F7531FC8E0F30BB51FAA1B1357F">
<util:PermissionEx User="NT AUTHORITY\NETWORKSERVICE" GenericAll="yes" />
</CreateFolder>
<ServiceInstall Id="siRedisService" DisplayName="Redis" Arguments="--service-run "[#filF5607FB03CD4B203C699DA14D17FF53B]"" ErrorControl="normal" Name="Redis" Start="auto" Type="ownProcess" Vital="yes" Account="NT AUTHORITY\NETWORKSERVICE"/>
<ServiceControl Id="scRedisService" Name="Redis" Start="install" Stop="both" Remove="both" Wait="yes" />
</Component>发布于 2014-08-28 17:37:29
这确实是很多定制动作。我会把他们赶走的。以下是我的滚动方式:
<Component Id="redacted" Guid="redacted">
<File Id="redacted" Source="$(var.SourceDir)\redis-server.exe" KeyPath="yes" />
<ServiceInstall Id="siRedisService" Description="Redis Service" DisplayName="Redis" Arguments="--service-run redis.windows.conf --loglevel verbose" ErrorControl="normal" Name="Redis" Start="auto" Type="ownProcess" Vital="yes" Account="NT AUTHORITY\NetworkService"/>
<ServiceControl Id="scRedisService" Name="Redis" Start="install" Stop="both" Remove="both" Wait="yes" />
</Component>
<Component Id="redacted" Guid="redacted">
<File Id="redacted" Source="$(var.SourceDir)\redis.windows.conf" KeyPath="yes" />
</Component>我以前说过很多次了.服务就是服务。除了ServiceInstall和ServiceControl之外的其他任何东西,以及偶尔的注册表条目,都是一种自我注册反模式疯狂的形式。服务可以用不同的语言编写,并由不同的运行时托管,但是它们与服务控制管理器API的交互都是相同的,一旦解决了这些细节,MSI就可以本机处理它。
https://stackoverflow.com/questions/25552918
复制相似问题