本文介绍了使用 .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:关键词]
发布评论