2

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

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

框架版本:v4.0.30319 描述:进程因未处理的异常而终止。

异常信息:System.IO.FileNotFoundException

堆栈:在 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>

我还尝试省略“开始”属性并尝试手动启动它,结果相同。

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

谢谢!

4

2 回答 2

2

添加到@Christopher Painter 所说的内容,我将假设问题不在于安装,而在于安装的内容,您已经暗示不确定您的服务具有什么依赖项,因此您应该开始诊断您的应用程序需要哪些依赖项。

Install the application but do not start the service, then start the service manually and by using Assembly Binding Log Viewer this will allow you to view binding failures at runtime, you may have to set HKLM\Software\Microsoft\Fusion\ForceLog to 1 to get all failures (see link for more details).

于 2013-01-07T20:42:29.357 回答
1

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

于 2013-01-07T15:15:50.557 回答