如何在没有权限错误的情况下安装系统服务
How to install a system service without permission errors
我在 运行 将我的安装程序连接到辅助 PC 时出现以下错误,但是当我 运行 它在我的开发机器上时它可以正常工作。
MSI (s) (90:2C) [16:22:35:704]: Executing op: ServiceInstall(Name=PCR2,DisplayName=Amusoft PC Remote 2,ImagePath="C:\Program Files\Amusoft\PC Remote 2\web\Amusoft.PCR.Server.exe",ServiceType=16,StartType=2,ErrorControl=32771,,Dependencies=[~],,StartName=LocalSystem,Password=**********,Description=Backend service required for PC Remote to interact with this computer,,)
InstallServices: Service:
Error 1923. Service 'Amusoft PC Remote 2' (PCR2) could not be installed. Verify that you have sufficient privileges to install system services.
这是我安装启动服务的片段
<Fragment>
<Component Id="RegistrySetValues" Guid="CCA1011E-0C44-4111-9089-A4F5D49D3D51" Win64="yes" Directory="WEBFOLDER">
<RegistryKey Root="HKLM" Key="SOFTWARE\Amusoft\PC Remote 2" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
<RegistryValue
Type="string"
Name="InstallLocation"
Value="[PRODUCTNAMEFOLDER]"/>
<RegistryValue
Type="string"
Name="Version"
Value="$(var.ProductVersion)"/>
</RegistryKey>
</Component>
<Component Id='BackendServerExe' Guid='7B39D2A5-140F-452D-BAEC-0B965A15CCC9' Directory='WEBFOLDER'>
<File Id='BackendServer' Name='Amusoft.PCR.Server.exe' Vital='yes' Source='$(var.SolutionDir)..\artifacts\msi\web\Amusoft.PCR.Server.exe' KeyPath='yes'/>
<fire:FirewallException
Name='Amusoft PC Remote 2 Server'
Id='BackendServerFirewall'
Port='[CUSTOM_PORT]'
Protocol='tcp'
Profile='all'
Scope='localSubnet'
IgnoreFailure='no'
Description='Amusoft PC Remote 2 Server'/>
<ServiceInstall Name='$(var.ServiceName)'
Type='ownProcess'
Start='auto'
Account="LocalSystem"
DisplayName="Amusoft PC Remote 2"
Id="PCR2.Install"
Description="Backend service required for PC Remote to interact with this computer"
Vital="yes" ErrorControl="critical">
<!-- Vital="yes" ErrorControl="critical"> -->
<util:ServiceConfig
FirstFailureActionType="restart"
SecondFailureActionType="restart"
ThirdFailureActionType="none"
ResetPeriodInDays="1"
ServiceName="$(var.ServiceName)"
RebootMessage="PC Remote 2 requires a reboot"
RestartServiceDelayInSeconds="180"
/>
</ServiceInstall>
<!-- <ServiceControl Id="PCR2.Control.Start" -->
<!-- Name="$(var.ServiceName)" -->
<!-- Start="install" -->
<!-- Wait="no" /> -->
<ServiceControl Id="PCR2.Control.Stop"
Name="$(var.ServiceName)"
Stop="uninstall"
Remove="uninstall"
Wait="yes" />
<!-- <ServiceControl Id="PCR2.Control" -->
<!-- Name="$(var.ServiceName)" -->
<!-- Remove="both" -->
<!-- Start="install" -->
<!-- Stop="both"/> -->
</Component>
</Fragment>
我查看了这些问题,但这并没有解决我的问题
- How to install and start a Windows Service using WiX
- Wix installer: Verify that you have sufficient privileges to start system services
这与强名称签名有关吗?我不明白为什么它在我的开发机器上工作,但在辅助机器上失败
解决方案:缺少 .NET 5 托管运行时。
Lacking Runtime: Typically you lack a runtime if the service starts on your dev-computer and not on the test box. Common lacking
runtimes: .Net
, .Net Core
, Java
, VC++ Runtime
, MS-XML (legacy)
, etc...
Virtual machines often lack most runtimes in their base state, and this is a very common problem when testing setups.
调试二进制文件:上述的另一种变体是安装依赖于与发布版本文件完全不同的运行时文件的调试二进制文件.这些调试二进制文件是您在 Visual Studio 项目中使用 "Debug"
配置时构建的二进制文件。它们依赖于在文件名中添加了“d”的 dll (C++)。
其他想法:还有许多其他潜在原因。以下是应用程序和服务启动失败的一些检查列表:
- Crash on Launch
- Application Launch Problems
Bitness:应该将位数作为另一个“第一个问题”来检查(x86 与 x64 二进制文件 - 不兼容和混淆)。
其他链接:
- Tools for dependency scanning your binaries
- Windows Services Frequently Asked Questions (FAQ)
- General debugging links of various types
我在 运行 将我的安装程序连接到辅助 PC 时出现以下错误,但是当我 运行 它在我的开发机器上时它可以正常工作。
MSI (s) (90:2C) [16:22:35:704]: Executing op: ServiceInstall(Name=PCR2,DisplayName=Amusoft PC Remote 2,ImagePath="C:\Program Files\Amusoft\PC Remote 2\web\Amusoft.PCR.Server.exe",ServiceType=16,StartType=2,ErrorControl=32771,,Dependencies=[~],,StartName=LocalSystem,Password=**********,Description=Backend service required for PC Remote to interact with this computer,,)
InstallServices: Service:
Error 1923. Service 'Amusoft PC Remote 2' (PCR2) could not be installed. Verify that you have sufficient privileges to install system services.
这是我安装启动服务的片段
<Fragment>
<Component Id="RegistrySetValues" Guid="CCA1011E-0C44-4111-9089-A4F5D49D3D51" Win64="yes" Directory="WEBFOLDER">
<RegistryKey Root="HKLM" Key="SOFTWARE\Amusoft\PC Remote 2" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
<RegistryValue
Type="string"
Name="InstallLocation"
Value="[PRODUCTNAMEFOLDER]"/>
<RegistryValue
Type="string"
Name="Version"
Value="$(var.ProductVersion)"/>
</RegistryKey>
</Component>
<Component Id='BackendServerExe' Guid='7B39D2A5-140F-452D-BAEC-0B965A15CCC9' Directory='WEBFOLDER'>
<File Id='BackendServer' Name='Amusoft.PCR.Server.exe' Vital='yes' Source='$(var.SolutionDir)..\artifacts\msi\web\Amusoft.PCR.Server.exe' KeyPath='yes'/>
<fire:FirewallException
Name='Amusoft PC Remote 2 Server'
Id='BackendServerFirewall'
Port='[CUSTOM_PORT]'
Protocol='tcp'
Profile='all'
Scope='localSubnet'
IgnoreFailure='no'
Description='Amusoft PC Remote 2 Server'/>
<ServiceInstall Name='$(var.ServiceName)'
Type='ownProcess'
Start='auto'
Account="LocalSystem"
DisplayName="Amusoft PC Remote 2"
Id="PCR2.Install"
Description="Backend service required for PC Remote to interact with this computer"
Vital="yes" ErrorControl="critical">
<!-- Vital="yes" ErrorControl="critical"> -->
<util:ServiceConfig
FirstFailureActionType="restart"
SecondFailureActionType="restart"
ThirdFailureActionType="none"
ResetPeriodInDays="1"
ServiceName="$(var.ServiceName)"
RebootMessage="PC Remote 2 requires a reboot"
RestartServiceDelayInSeconds="180"
/>
</ServiceInstall>
<!-- <ServiceControl Id="PCR2.Control.Start" -->
<!-- Name="$(var.ServiceName)" -->
<!-- Start="install" -->
<!-- Wait="no" /> -->
<ServiceControl Id="PCR2.Control.Stop"
Name="$(var.ServiceName)"
Stop="uninstall"
Remove="uninstall"
Wait="yes" />
<!-- <ServiceControl Id="PCR2.Control" -->
<!-- Name="$(var.ServiceName)" -->
<!-- Remove="both" -->
<!-- Start="install" -->
<!-- Stop="both"/> -->
</Component>
</Fragment>
我查看了这些问题,但这并没有解决我的问题
- How to install and start a Windows Service using WiX
- Wix installer: Verify that you have sufficient privileges to start system services
这与强名称签名有关吗?我不明白为什么它在我的开发机器上工作,但在辅助机器上失败
解决方案:缺少 .NET 5 托管运行时。
Lacking Runtime: Typically you lack a runtime if the service starts on your dev-computer and not on the test box. Common lacking runtimes:
.Net
,.Net Core
,Java
,VC++ Runtime
,MS-XML (legacy)
,etc...
Virtual machines often lack most runtimes in their base state, and this is a very common problem when testing setups.
调试二进制文件:上述的另一种变体是安装依赖于与发布版本文件完全不同的运行时文件的调试二进制文件.这些调试二进制文件是您在 Visual Studio 项目中使用 "Debug"
配置时构建的二进制文件。它们依赖于在文件名中添加了“d”的 dll (C++)。
其他想法:还有许多其他潜在原因。以下是应用程序和服务启动失败的一些检查列表:
- Crash on Launch
- Application Launch Problems
Bitness:应该将位数作为另一个“第一个问题”来检查(x86 与 x64 二进制文件 - 不兼容和混淆)。
其他链接:
- Tools for dependency scanning your binaries
- Windows Services Frequently Asked Questions (FAQ)
- General debugging links of various types