2013-01-07 68 views
2

我已經爲Windows服務創建了Wix安裝項目。在我的本地開發人員計算機(Windows 7 - 64)上運行並開始沒有問題。但是,當我嘗試在Windows Server 2008上安裝它時,出現「驗證您有足夠的特權......」的「常見」錯誤。在事件查看器,我可以看到,這是造成.NET運行時拋出一個FileNotFoundException異常針對Windows服務的Wix安裝項目導致FileNotFoundException

應用:RT.Tools.AutoBettingWinService.exe

Framework版本: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?

謝謝!

回答

2

添加到@Christopher Painter所說的內容中,我將假定問題不在於安裝,而是安裝了而不是,您已經暗示不確定您的服務具有何種依賴關係,所以你應該開始診斷你的應用程序需要什麼依賴。

安裝應用程序,但不啓動該服務,然後手動和使用Assembly Binding Log Viewer啓動服務,這將允許您查看在運行時綁定失敗,您可能需要設置HKLM\Software\Microsoft\Fusion\ForceLog 1獲得所有的失敗(見鏈接更多細節)。

1

您需要對服務進行概要分析以找出FileNotFound異常引用的內容並將其添加到安裝程序中。此外,Windows安裝程序組件規則規定您的每個DLL文件都需要成爲其自己組件的密鑰文件。

+1

順便說一句,一定要了解一個服務的工作目錄是System32。如果你正在尋找%CD%\ 1000UserIds.txt,它將不會被發現。您必須確定正在執行的程序集的目錄,然後在該文件夾中查找它。 –