使用 .Net ServiceInstaller 在服务安装上设置“启动参数"?

编程入门 行业动态 更新时间:2024-10-09 20:29:20
本文介绍了使用 .Net ServiceInstaller 在服务安装上设置“启动参数"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在编写一个小的 Windows 服务应用程序,我可以通过这样的方式成功地安装/卸载它等:

I am currently writing a little windows service application and I can successfully in/uninstall it etc via something like this:

        serviceProcessInstaller = new ServiceProcessInstaller();
        serviceInstaller = new System.ServiceProcess.ServiceInstaller();
        serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
        serviceInstaller.ServiceName = "ABC";
        serviceInstaller.StartType = ServiceStartMode.Automatic;
        serviceInstaller.Description = "DEF";
        Installers.AddRange(new Installer[] { serviceProcessInstaller, serviceInstaller });

...但我显然无法在那里设置启动参数...或者我可以吗?我宁愿稍后不继续修改注册表...因此问题...有什么办法可以以编程方式设置这些参数?

... but I apparently cannot set the startup parameters there... or can I? I'd rather not go ahead and modify the registry later on.. therefore the Question... is there any way I can set these parameters programatically?

推荐答案

我找到了一种在服务安装时添加启动参数的方法:

I have found a way to add start parameters on service installation:

我是否作为服务运行

这篇关于使用 .Net ServiceInstaller 在服务安装上设置“启动参数"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-03-30 21:04:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/787926.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:装上   参数   Net   ServiceInstaller   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!