0

我有 WCF 服务,我可以从 WCF 客户端成功构建和测试(从 CMD Installutill 安装)。现在我创建了一个 wix 安装程序项目来为相同的 WCF 服务创建一个 exe。以下是我使用的 WIX 代码:

 <Fragment>
<ComponentGroup Id="ProductComponents" Directory="TestWCFService">
  <Component Id="TestWCFService.exe" Guid="F071A592-33A9-44DA-A81B-AD4AC8195757">
    <File Id="TestWCFService.exe" Source="$(var.TestWCFService.TargetDir)TestWCFService.exe" KeyPath="yes"  Vital="yes" DiskId="1"/>
    <ServiceInstall 
      Id="TestWCFService" 
      Name="TestWCFService" 
      Account="LocalSystem" 
      Start="auto" 
      Interactive="no" 
      Type="ownProcess" 
      Vital="yes" 
      ErrorControl="critical" />
    <ServiceControl Id="TestWCFService" Name="TestWCFService" Start="install" Stop="both" Remove="both" Wait="yes" />
  </Component>
  <Component Id ="TestWCFService.Config" >
    <File Name="TestWCFService.Config" Source = "$(var.TestWCFService.TargetDir)TestWCFService.exe.Config" />
  </Component>
    <File Name="TestUtilities.dll" Source= "$(var.TestWCFService.TargetDir)TestUtilities.dll"  />
  </Component>
  <Component Id="NLog.dll">
    <File Name="NLog.dll" Source= "$(var.TestWCFService.TargetDir)NLog.dll" />
  </Component>
</ComponentGroup>

WIX 输出 exe 包将成功安装(作为 Windows 服务)并自动启动。之后,当我使用相同的 WCF 测试客户端进行测试时,我看不到服务正在运行。

4

1 回答 1

0

以下答案是我从乔的 WIX 社区得到的:

已安装的程序正在寻找 TestWCFService.exe.Config,但我们部署了具有不同扩展名 TestWCFService.Config 的相同文件。

<Component Id ="TestWCFService.Config" >
<File Name="**TestWCFService.Config**" Source = "$(var.TestWCFService.TargetDir)**TestWCFService.exe.Config**" />

于 2017-09-13T07:53:29.603 回答