设置“启动参数”的服务安装与.net的ServiceInstaller? [英] Set 'Start Parameters' on Service Installation with .Net ServiceInstaller?

查看:205
本文介绍了设置“启动参数”的服务安装与.net的ServiceInstaller?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在写一个小窗口服务应用程序,我可以成功地在/卸载等,通过这样的:

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:

<一个href="http://stackoverflow.com/questions/200163/am-i-running-as-a-service/2111492#2111492">http://stackoverflow.com/questions/200163/am-i-running-as-a-service/2111492#2111492

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆