Windows服务的Wix安装项目导致FileNotFoundException

时间:2013-01-07 15:12:18

标签: .net wix windows-installer installation

我为Windows服务创建了一个Wix安装项目。在我的本地开发人员计算机(Windows 7 - 64)上,它运行并启动没有问题。但是,当我尝试在Windows Server 2008上安装它时,我会收到“验证您有足够的权限......”的“常见”错误。在事件查看器中,我可以看到这是由.NET Runtime引发FileNotFoundException引起的

  

应用程序:RT.Tools.AutoBettingWinService.exe

     

框架版本:v4.0.30319描述:由于未处理的异常,进程已终止。

     

异常信息:System.IO.FileNotFoundException

     

Stack:at RT.Tools.AutoBettingWinService.Program.Main()

我已经尝试在我的.wxs文件中添加了我能想到的所有文件。它如下

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="*" Name="AutoBettingWinService.Setup" Language="1033" Version="1.0.0.0" Manufacturer="Norsk RT" UpgradeCode="5756e8b0-3eef-4b1c-9c74-60c05386bff5">

        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
        <MediaTemplate />

        <Feature Id="ProductFeature" Title="AutoBettingWinService.Setup" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
        </Feature>
    </Product>

    <Fragment>
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder">
                <Directory Id="INSTALLFOLDER" Name="AutoBettingWinService.Setup" >
        </Directory>
            </Directory>
        </Directory>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
            <Component Id="RT.Tools.AutoBettingWinService" Guid="{8B3B5B09-701E-4BA4-9FD2-093072B303D3}">
        <File Id="Common.Logging.dll" Name="Common.Logging.dll" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\Common.Logging.dll" Vital="yes" KeyPath="no" DiskId="1"/>
        <File Id="RT.Tools.Betting.dll" Name="RT.Tools.Betting.dll" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\RT.Tools.Betting.dll" Vital="yes" KeyPath="no" DiskId="1"/>
        <File Id="Moq.dll" Name="Moq.dll" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\Moq.dll" Vital="yes" KeyPath="no" DiskId="1"/>
        <File Id="Newtonsoft.Json.dll" Name="Newtonsoft.Json.dll" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\Newtonsoft.Json.dll" Vital="yes" KeyPath="no" DiskId="1"/>
        <File Id="nunit.framework.dll" Name="nunit.framework.dll" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\nunit.framework.dll" Vital="yes" KeyPath="no" DiskId="1"/>
        <File Id="Quartz.dll" Name="Quartz.dll" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\Quartz.dll" Vital="yes" KeyPath="no" DiskId="1"/>
        <File Id="RT.Testing.dll" Name="RT.Testing.dll" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\RT.Testing.dll" Vital="yes" KeyPath="no" DiskId="1"/>
        <File Id="RT.WebAPI.dll" Name="RT.WebAPI.dll" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\RT.WebAPI.dll" Vital="yes" KeyPath="no" DiskId="1"/>
        <File Id="System.Net.Http.dll" Name="System.Net.Http.dll" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\System.Net.Http.dll" Vital="yes" KeyPath="no" DiskId="1"/>
        <File Id="System.Net.Http.Formatting.dll" Name="System.Net.Http.Formatting.dll" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\System.Net.Http.Formatting.dll" Vital="yes" KeyPath="no" DiskId="1"/>
        <File Id="System.Net.Http.WebRequest.dll" Name="System.Net.Http.WebRequest.dll" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\System.Net.Http.WebRequest.dll" Vital="yes" KeyPath="no" DiskId="1"/>
        <File Id="System.Web.Http.dll" Name="System.Web.Http.dll" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\System.Web.Http.dll" Vital="yes" KeyPath="no" DiskId="1"/>
        <File Id="System.Web.Http.WebHost.dll" Name="System.Web.Http.WebHost.dll" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\System.Web.Http.WebHost.dll" Vital="yes" KeyPath="no" DiskId="1"/>
        <File Id="Thinktecture.IdentityModel.dll" Name="Thinktecture.IdentityModel.dll" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\Thinktecture.IdentityModel.dll" Vital="yes" KeyPath="no" DiskId="1"/>

        <File Id="_1000UserIds.txt" Name="1000UserIds.txt" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\1000UserIds.txt" Vital="yes" KeyPath="no" DiskId="1"/>

        <File Id="RT.Tools.AutoBettingWinService.exe.manifest" Name="RT.Tools.AutoBettingWinService.exe.manifest" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\RT.Tools.AutoBettingWinService.exe.manifest" Vital="yes" KeyPath="no" DiskId="1"/>
        <File Id="RT.Tools.AutoBettingWinService.exe.config" Name="RT.Tools.AutoBettingWinService.exe.config" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\RT.Tools.AutoBettingWinService.exe.config" Vital="yes" KeyPath="no" DiskId="1"/>

        <File Id="RT.Tools.AutoBettingWinService.pdb" Name="RT.Tools.AutoBettingWinService.pdb" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\RT.Tools.AutoBettingWinService.pdb" Vital="yes" KeyPath="no" DiskId="1"/>
        <File Id="RT.Tools.AutoBettingWinService.exe" Name="RT.Tools.AutoBettingWinService.exe" Source="..\RT.Tools.AutoBettingWinService\bin\Debug\RT.Tools.AutoBettingWinService.exe" Vital="yes" KeyPath="yes" DiskId="1"/>
        <ServiceInstall
              Id="ServiceInstaller"
              Type="ownProcess"
              Vital="yes"
              Name="AutoBettingService"
              DisplayName="AutoBettingService"
              Description="Places bets automatically a given time of day"
              Start="auto"
              Account="NT AUTHORITY\NETWORK SERVICE"
              ErrorControl="normal"
              Interactive="no"
              >
        </ServiceInstall>
        <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="AutoBettingService" Wait="yes" />
      </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

我还尝试省略'Start'属性并尝试手动启动它,结果相同。

有谁能告诉我我的设置有什么问题?为什么FileNotFoundException?

谢谢!

2 个答案:

答案 0 :(得分:2)

除了@Christopher Painter所说的,我将假设问题不在于安装,而在于正在安装什么,你已经暗示不确定是什么您的服务具有依赖关系,因此您应该开始诊断应用程序所需的依赖关系。

安装应用程序但不启动服务,然后手动启动服务并使用Assembly Binding Log Viewer这将允许您在运行时查看绑定失败,您可能必须将HKLM\Software\Microsoft\Fusion\ForceLog设置为1得到所有失败(详见链接)。

答案 1 :(得分:1)

您需要对服务进行概要分析,以找出FileNotFound异常引用的内容并将其添加到安装程序中。此外,Windows Installer组件规则规定每个DLL文件都需要是其自己组件的密钥文件。