2013-08-29 80 views
0

我正在使用wix創建安裝程序,並且它正在掛起StartServices操作。下面是我安裝的唯一服務:WiX v3.7 - 安裝程序卡在「正在啓動服務」

<Component Id="CMP_RemindexNP.exe" Guid="{3FB99890-752D-4652-9412-72230695A520}"> 
    <File Id="FILE_INSTALLFOLDER_RemindexNPEXE" Source="RemindexNP.exe" KeyPath="yes"/> 
    <RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\RemindexNP\Parameters"> 
     <RegistryValue Id="rg_remNP1" Action="write" Name="AppDirectory" Value="[INSTALLFOLDER]" Type="string"/> 
     <RegistryValue Id="rg_remNP2" Action="write" Name="Application" Value="[INSTALLFOLDER]RemindexNP.exe" Type="string"/> 
    </RegistryKey> 
    <ServiceInstall DisplayName="RemindexNP" Id="srv_remNP" Name="RemindexNP" Start="auto" Type="shareProcess" ErrorControl="ignore"/> 
    <ServiceControl Id="srvc_remNP" Name="RemindexNP" Remove="both" Start="install" Stop="uninstall" Wait="no"/> 
</Component> 

這裏的日誌文件中的StartService行動:

Action 17:15:08: StartServices. Starting services 
Action start 17:15:08: StartServices. 
StartServices: Service: Starting services 
Action ended 17:15:08: StartServices. Return value 1. 

如果我等待5 - 10分鐘後,安裝一些關於「結束過早的」 。或者我可以在任務管理器中停止任務,幾分鐘後,我會看到相同的對話框。

我試過將ServiceInstall中的Type屬性設置爲shareProcess和ownProcess,這兩者都不起作用。我也嘗試設置等待和否。

我的ServiceInstall元素有問題嗎?

任何建議將不勝感激。

+0

[WiX v3.7 - 自定義操作中批處理文件的複製行爲]的可能重複(http://stackoverflow.com/questions/18495579/wix-v3-7-replicate-behavior-of-a-批處理文件中的自定義操作) –

+0

您已經在我提供給您答案的位置轉貼了您的上一個問題。在這個問題中,你省略了對srvany.exe的引用,這將使人們無法知道你的問題。 –

回答

0

我在我的安裝程序中有以下服務組件,它的工作原理。當在服務未正確啓動的安裝過程中遇到問題時,在服務中使用某種記錄機制非常有幫助。由於某些配置錯誤導致服務無法啓動,因此安裝無法完成。我無法分析和解決問題,因爲我無法查看由我的安裝程序創建並由該服務使用的事件日誌。我建議你走相同的路線,因爲語法上你的ServiceInstall和ServiceControl元素看起來是正確的。

<Component Id="CMP_SERVICE" Guid="YOURGUIDHERE"> 
<File Source="Files/Service.exe" Id="Service.exe" KeyPath="yes" Compressed="no" /> 
<ServiceInstall 
    Id="SvcInstallService" 
    Name="Service" 
    DisplayName="Service" 
    Type="ownProcess" 
    Description="Service Desc" 
    Start="auto" 
    ErrorControl="normal"> 
    <util:ServiceConfig 
    ServiceName="Service" 
    FirstFailureActionType="restart" 
    SecondFailureActionType="restart" 
    ResetPeriodInDays="1" 
    RestartServiceDelayInSeconds="5" 
    ThirdFailureActionType="restart"/> 
</ServiceInstall> 
<ServiceControl 
    Id="sc_Service" 
    Name="Service" 
    Start="install" 
    Stop="both" 
    Remove="uninstall" 
    Wait="no" /> 
</Component> 

要創建Eventlogsource使用類似下面的代碼:

<PropertyRef Id="NETFRAMEWORK20"/> 
<PropertyRef Id="NETFRAMEWORK40FULL"/> 
<Component Id="CMP_ServiceEventLogNetfx2" Guid="YOURGUIDHERE"> 
    <util:EventSource Name="Service" EventMessageFile="{[NETFRAMEWORK20INSTALLROOTDIR]}EventLogMessages.dll" Log="YourLog" KeyPath="yes"/> 
    <Condition> 
     <![CDATA[(Installed OR NETFRAMEWORK20) AND VersionNT < 600]]> 
    </Condition> 
</Component> 
<Component Id="CMP_ServiceEventLogNetfx4" Guid="YOURGUIDHERE"> 
    <util:EventSource Name="Service" EventMessageFile="{[NETFRAMEWORK20INSTALLROOTDIR]}EventLogMessages.dll" Log="YourLog" KeyPath="yes"/> 
    <Condition> 
     <![CDATA[(Installed OR NETFRAMEWORK40FULL) AND VersionNT >= 600]]> 
    </Condition> 
</Component> 

當然,你必須使用該事件日誌中您服務。爲此,使用System.Diagnostics.EventLog類及其WriteEntry方法。

最後一步是在安裝過程中打開eventviewer(eventvwr.msc)並查看服務的日誌。

相關問題