我正在尝试为Windows服务创建安装程序,但我不知道它为什么失败。安装Windows服务的问题
这里的片段,我定义服务相关的部分:
<ComponentGroup Id="ServiceComponents" Directory="InstallDirectory">
<Component Id="ThingService" Guid="1F4D7F24-BC66-4E7A-AC33-A7E2133FC5B8" KeyPath="yes">
<ServiceInstall Id="ThingServiceInstaller"
Type="ownProcess"
Name="ThingService"
DisplayName="Thing"
Description="Does Thing."
Start="auto"
ErrorControl="normal"
Vital="yes" />
<ServiceControl Id="StartService"
Start="install"
Stop="both"
Remove="uninstall"
Name="ThingService"
Wait="yes" />
</Component>
</ComponentGroup>
这是一个运行的最后一部分 - 该文件是所有早期部署的,我可以看到他们得到他们应该在那里至。当它到达启动服务,我得到以下错误:
Service 'ThingService' (ThingService) failed to start. Verify that you have sufficient priveleges to start system services.
不过,我没有看到在服务列表中的服务好,所以我不知道它甚至试图启动。我觉得我错过了某种指向Thing.exe
的指针,但我看到的例子似乎也没有。
下面是详细日志,似乎是相关的部分:
1:
MSI (s) (50:F8) [16:14:38:880]: Component: ThingService; Installed: Absent; Request: Local; Action: Local
2:
MSI (s) (50:F8) [16:14:40:736]: Doing action: StopServices
MSI (s) (50:F8) [16:14:40:736]: Note: 1: 2205 2: 3: ActionText
Action 16:14:40: StopServices. Stopping services
Action start 16:14:40: StopServices.
StopServices: Service: Stopping services
Action ended 16:14:40: StopServices. Return value 1.
MSI (s) (50:F8) [16:14:40:740]: Doing action: DeleteServices
MSI (s) (50:F8) [16:14:40:740]: Note: 1: 2205 2: 3: ActionText
Action 16:14:40: DeleteServices. Deleting services
Action start 16:14:40: DeleteServices.
Action ended 16:14:40: DeleteServices. Return value 1.
MSI (s) (50:F8) [16:14:40:747]: Doing action: RemoveRegistryValues
MSI (s) (50:F8) [16:14:40:747]: Note: 1: 2205 2: 3: ActionText
Action 16:14:40: RemoveRegistryValues. Removing system registry values
Action start 16:14:40: RemoveRegistryValues.
Action ended 16:14:40: RemoveRegistryValues. Return value 1.
3:
MSI (s) (50:F8) [16:14:40:944]: Doing action: InstallServices
MSI (s) (50:F8) [16:14:40:944]: Note: 1: 2205 2: 3: ActionText
Action 16:14:40: InstallServices. Installing new services
Action start 16:14:40: InstallServices.
Action ended 16:14:40: InstallServices. Return value 1.
MSI (s) (50:F8) [16:14:40:945]: Doing action: StartServices
MSI (s) (50:F8) [16:14:40:945]: Note: 1: 2205 2: 3: ActionText
Action 16:14:40: StartServices. Starting services
Action start 16:14:40: StartServices.
StartServices: Service: Starting services
Action ended 16:14:40: StartServices. Return value 1.
4 :
MSI (s) (50:F8) [16:14:40:994]: Executing op: ActionStart(Name=StopServices,Description=Stopping services,Template=Service: [1])
Action 16:14:40: StopServices. Stopping services
MSI (s) (50:F8) [16:14:40:996]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000)
MSI (s) (50:F8) [16:14:40:996]: Executing op: ServiceControl(,Name=ThingService,Action=2,Wait=1,)
MSI (s) (50:F8) [16:14:40:996]: Executing op: ActionStart(Name=CreateFolders,Description=Creating folders,Template=Folder: [1])
5:
MSI (s) (50:F8) [16:14:41:817]: Executing op: ActionStart(Name=StartServices,Description=Starting services,Template=Service: [1])
Action 16:14:41: StartServices. Starting services
MSI (s) (50:F8) [16:14:41:817]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000)
MSI (s) (50:F8) [16:14:41:817]: Executing op: ServiceControl(,Name=ThingService,Action=1,Wait=1,)
StartServices: Service: ThingService
Error 1920. Service 'ThingService' (ThingService) failed to start. Verify that you have sufficient privileges to start system services.
EDIT1:它看起来像问题是与分裂,则ServiceInstall /的ServiceControl到各自的组成部分,因为它的工作原理,如果我把它们放进相同的组件,其中文件被定义。
我想看看为什么您的InstallServices操作返回1而不是0。您可能还需要在ThingServiceInstaller上设置Vital =“yes”,以便在安装失败时整体安装失败。 – ssnobody
@ssnobody:'Vital =“yes”'已经在'ThingServiceInstaller'上 - 这是最后一行。任何想法到什么看? – zimdanen
我将删除在安装时启动服务,所以只需安装服务,然后尝试手动启动服务以查看问题出在哪里,也许您的应用程序不是以本地系统启动。同时检查事件查看器是否存在应用程序崩溃。 – IlirB