2012-10-30 85 views
2

我正在使用WiX 3.6爲Windows服務創建安裝程序。我有解決方案的建設,並能夠在我的開發機器上安裝服務,服務開始就像我想要的。由Wix安裝的Windows服務

當我將msi(Build或Release)複製到服務將運行的Windows Server 2003 R2計算機時,出現問題。
我能夠安裝服務,但是當我嘗試啓動服務,我得到一個錯誤

「服務啓動失敗。請確認您有足夠的權限 啓動系統服務。」

現在我可以安裝並啓動我創建的其他服務,因此我現在可以對服務器有權限。以下是我的服務安裝元素。

我的問題是,我錯過服務在開發機器上而不是服務器上啓動?

<File Id="CopyService.exe" Name="CopyService.exe" Source="..\CopyService\bin\$(var.CopyService.Configuration)\CopyService.exe" Vital="yes" KeyPath="yes" DiskId="1"/> 
    <File Id="App.config" Name="CopyService.exe.config" Source="..\CopyService\bin\$(var.CopyService.Configuration)\CopyService.exe.config" Vital="yes" KeyPath="no" DiskId="1"/> 
     <ServiceInstall 
       Id="ServiceInstaller" 
       Type="ownProcess" 
       Vital="yes" 
       Name="ACSIAccountingReports" 
       DisplayName="ACSI Accounting Reports" 
       Description="Service copies accounting reports from NetForum into an ACSI network folder." 
       Start="auto" 
       Account="LocalSystem" 
       ErrorControl="ignore"   
       Interactive="no"> 
    </ServiceInstall> 
    <ServiceControl Id="StartService" Name="ACSIAccountingReports" Start="install" Wait="yes" /> 
    <ServiceControl Id="StopService" Name="ACSIAccountingReports" Stop="both" Wait="yes" Remove="uninstall" /> 
+0

應該指出,這是我的第一個WiX項目。我爲其他服務創建的安裝程序是VS 2010安裝項目。 – Sean

+0

夫婦觀察,而不是答案。 1.根據我的經驗,您不能爲一個服務擁有兩個ServiceControl元素,我發現只有一個會運行,哪一個不清楚。 2.您是否在GAC中使用組件?如果是這樣,他們不會安裝,直到服務開始調用後,這往往會產生你所看到的錯誤。 – Neil

回答

1

您看到的錯誤消息是Windows Installer對所有服務安裝失敗的默認錯誤消息。這不是非常有幫助。要調試真正的問題,請嘗試再次啓動您的服務錯誤對話框已啓動。很可能您會收到有關您的服務未啓動的更詳細的錯誤消息。如果您仍然沒有收到任何信息,請嘗試使用像depend.exe或fuslogvw這樣的工具(打開NETFX程序集加載失敗)來查看服務可執行文件是否有一些缺失的依賴關係。

請記住,GAC'd文件直到安裝結束才完成。因此,您的服務不能依賴GAC'd文件並在安裝過程中啓動服務。

+0

羅布,感謝您的提示。我已經忘記了這個線程已經很久了。我能夠在Windows Server 2008 R2中安裝該服務,因爲我從未在2003服務器上工作過。 – Sean