当前位置: 首页 > 编程语言 > C#

installutil成功完成但没有安装服务分享

时间:2023-04-10 13:10:53 C#

installutil成功完成但没有安装服务我正在尝试安装Windows服务。运行c:\windows\microsoft.netFramework64v4.0.30319InstallUtil.exec:\fooMyAssembly.exe我收到一条消息,指出所有阶段(安装、提交)均已成功完成。(系统未提示我提供服务凭据)之后,我在服务控制台中看不到该服务。安装日志中没有任何用处。该解决方案建立在64位机器上,我正在尝试在64位机器上安装该服务。但是,我没有看到64位选项作为解决方案属性。我手动编辑了所有csproj文件,为[platform]节点选择了“x64”。我可以毫无问题地运行visualstudio服务。installer.cs[RunInstaller(true)]publicpartialclassInstaller:System.Configuration.Install.Installer{publicInstaller(){InitializeComponent();这是visualstudio提供的默认安装程序。您需要将一些Installer对象添加到Installers集合中。下面是安装Windows服务的示例。像[RunInstaller(true)]publicclassInstaller:System.Configuration.Install.Installer{privateServiceInstallerserviceInstaller;私有ServiceProcessInstallerprocessInstaller;publicInstaller(){//为进程和服务实例化安装程序。processInstaller=newServiceProcess(Installer);InstallerserviceInstaller=newServiceInstaller();//服务在系统账户下运行。processInstaller.Account=ServiceAccount.LocalSystem;//服务是手动启动的。serviceInstaller.StartType=ServiceStartMode.Manual;//ServiceName必须等于ServiceBase派生类中的那些。serviceInstaller.ServiceName="Hello-WorldService1";//将安装程序添加到集合中。顺序并不重要。安装程序。添加(服务安装程序);Installers.Add(processInstaller);下面的SO问题有类似的场景和答案,这些场景和答案也可能与来自Google搜索链接的人有关。安装在VisualStudio中创建的Windows服务以上是C#学习教程:installutil成功完成但是没有安装服务。分享的所有内容,如果对大家有用,需要了解更多C#学习教程,希望大家多多关注——本文来自网络收藏,不代表立场,如涉及侵权,请点击有权联系管理员删除。如需转载请注明出处: