[英]How to install windows service using wix and not using ServiceInstall
[英]How to install and start a Windows Service using WiX
我試圖在Wix中使用下面的代碼。
但是在安裝時,安裝程序在狀態下凍結了3分鍾:啟動服務,然后我收到此消息“Service Jobservice無法啟動。驗證您是否具有足夠的權限來啟動系統服務”。 我的代碼有什么問題嗎? 我可以要求用戶在安裝過程中輸入Windows系統用戶名和密碼以獲得“權限”嗎?
非常感謝!
<File Id='JobServiceEXE' Name='JobService.exe' DiskId='1'
Source='JobService.exe' Vital='yes' KeyPath='yes'/>
<ServiceInstall Id="ServiceInstaller" Type="ownProcess" Vital="yes"
Name="JobService" DisplayName="123 Co. JobService"
Description="Monitoring and management Jobs" Start="auto"
Account="LocalSystem" ErrorControl="ignore" Interactive="no" />
<ServiceControl Id="StartService" Stop="both" Remove="uninstall"
Name="JobService" Wait="yes" />
</Component>
以下代碼適用於我...無需提示輸入用戶名/密碼:)
<File Id='JobServiceEXE' Name='JobService.exe' DiskId='1' Source='JobService.exe' KeyPath='yes'/>
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Name="JobService"
DisplayName="123 Co. JobService"
Description="Monitoring and management Jobs"
Start="auto"
Account="[SERVICEACCOUNT]"
Password="[SERVICEPASSWORD]"
ErrorControl="normal"
/>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="JobService" Wait="yes" />
</Component>
我發現此頁面上的解決方案將正確安裝服務,但ServiceControl元素將無法啟動該服務。
將wix安裝的服務與手動安裝的服務(“JobService.exe / install”)進行比較,“可執行路徑”字段缺少啟動開關。 使用ServiceInstall的arguments屬性在wix中修復此問題;
<File Id='JobServiceEXE' Name='JobService.exe' DiskId='1' Source='JobService.exe' KeyPath='yes'/>
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Name="JobService"
DisplayName="123 Co. JobService"
Description="Monitoring and management Jobs"
Start="auto"
Account="[SERVICEACCOUNT]"
Password="[SERVICEPASSWORD]"
ErrorControl="normal"
Arguments=" /start JobService"
/>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="JobService" Wait="yes" />
</Component>
很長一段時間,這是我在這里發表的第一篇文章 - 我希望它對某人有所幫助。
針對WiX版本3.x的用戶的更新。 以下代碼將在本地帳戶下安裝並啟動該服務。 請注意ServiceInstall標記中的Arguments屬性。
<File Source="$(var.MyService.TargetPath)" />
<ServiceInstall Id="ServiceInstaller" Name="MyService" Type="ownProcess" Vital="yes" DisplayName="My Service" Description="My Service Description" Start="auto" Account="LocalSystem" ErrorControl="normal" Arguments=" /start MyService" Interactive="no" />
<ServiceControl Id="StartService" Name="MyService" Stop="both" Start="install" Remove="uninstall" Wait="yes" />
對我來說,它至少有一次幫助,我刪除了安裝和卸載服務
<ServiceControl Remove="both" />
我認為這從Regedit中刪除了一些內容
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.