![](/img/trans.png)
[英]Windows service installer for different user account (other than local system)
[英]How to specify no account for Windows Service installer?
对于Windows服务项目,ServiceProcessInstaller具有名为“Account”的属性。 VS.NET强制为此值。 它是安装程序CS文件中自动生成的代码。
我想通过installutil参数指定帐户值。
如何在VS.NET中为“帐户”指定值?
只需保留ServiceProcessInstaller.Account默认值(serviceAccount = ServiceAccount.User,空用户名和密码)。 然后,ServiceProcessInstaller的私有GetLoginInfo()方法将查找可以在installutil命令行上传递的Context.Parameters字典中的值(例如“username”,“password”)。
要进一步自定义值,还应该可以覆盖servive的BeforeInstall事件中的设置,如下所示: http ://dotnetstep.blogspot.de/2009/06/passing-parameter-to-installutil.html
另请参阅ServiceProcessInstaller.Account属性的msdn文章。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.