使用WiX安装和运行.exe作为Windows服务
问题描述:
我有以下问题: 我有setup.py文件 - 我使用“python setup.py bdist_wininst”将其更改为.exe。安装这不是沉默,当我启动.exe文件安装程序要求我选择可取的Python安装,我希望setup.exe安装到。 现在我想安装这个.exe文件为Windows服务,这是我的维克斯代码:使用WiX安装和运行.exe作为Windows服务
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="TelnetInstaller" Language="1033" Version="1.0.0.0" Manufacturer="manufactur" UpgradeCode="24E13D15-CFF7-48EB-82EA-B1F9547F846C">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<WixVariable Id="WixUILicenseRtf" Value="$(var.ProjectDir)\License.rtf"/>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION"/>
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<UIRef Id="WixUI_InstallDir"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id='TempFolder'>
<Directory Id="INSTALLLOCATION" Name="MyApp" >
<Component Id='MyComponent' Guid='722E35C2-58F1-417D-AB02-2968CAF7C6D2'>
<File Id="mysetup_exe" Source="$(var.ProjectDir)\TelnetDS-0.9.win32.exe" />
<ServiceInstall
Id="ServiceInstaller"
Type="ownProcess"
Vital="yes"
Name="Telnet"
DisplayName="Telnet DS service"
Description="DS for communicating with devices via Telnet protocol."
Start="auto"
ErrorControl="normal"
Interactive="yes"
>
</ServiceInstall>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="Telnet" Wait="yes" />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="MainApplication" Title="Main Application" Level="1">
<ComponentRef Id="MyComponent" />
</Feature>
<!--<CustomAction Id="run_setup" FileKey="mysetup_exe" ExeCommand=""
Execute="deferred" Impersonate="yes"
Return="check" />
<InstallExecuteSequence>
<Custom Action="run_setup" Before="InstallFinalize">NOT Installed </Custom>
</InstallExecuteSequence>-->
</Product>
</Wix>
问题是,在期间产生的维克斯安装.msi文件有一个问题:“请确认您有足够的特权来安装系统服务“ 现在我不知道这是什么原因 - 是这种情况,我确实没有这种权限,或者我正在尝试安装需要我输入数据的.exe(选择python安装文件夹)作为服务。 你知道如何解决这个问题吗?问候
答
你可以尝试以下方法,
确保所有服务窗口开始安装/卸载或
安装.NET Framework 4.5版
Error 1920 service failed to start. Verify that you have sufficient privileges to start system servicesstart-verify-that-you-have-sufficient-privileges-t
我尝试过关闭它,不起作用。我决定使用NSSM https://nssm.cc/ –
好的,请检查并确认NSSM。 – prem
它可以工作,NSSM有一套很好的命令,你可以在cmd.exe中运行。 我刚添加了启动批处理文件的自定义操作,该文件使用NSSM命令来安装和运行我的服务 –