简体   繁体   English

如何为Windows Service安装程序指定无帐户?

[英]How to specify no account for Windows Service installer?

For a Windows Service project, the ServiceProcessInstaller has a property named "Account". 对于Windows服务项目,ServiceProcessInstaller具有名为“Account”的属性。 VS.NET forces a value for this. VS.NET强制为此值。 It's auto generated code in the installer's CS file. 它是安装程序CS文件中自动生成的代码。

I want to specify the account value through installutil parameters. 我想通过installutil参数指定帐户值。

How do I not specify a value for "Account" in VS.NET? 如何在VS.NET中为“帐户”指定值?

Simply keep the ServiceProcessInstaller.Account default value (serviceAccount = ServiceAccount.User, with empty username and password). 只需保留ServiceProcessInstaller.Account默认值(serviceAccount = ServiceAccount.User,空用户名和密码)。 The private GetLoginInfo() method of ServiceProcessInstaller then will look for values from the Context.Parameters dictionary (eg "username", "password") that can be passed on the installutil command line. 然后,ServiceProcessInstaller的私有GetLoginInfo()方法将查找可以在installutil命令行上传递的Context.Parameters字典中的值(例如“username”,“password”)。

To further customize the values it should also be possible to override setting in the BeforeInstall event of the servive as shown here: http://dotnetstep.blogspot.de/2009/06/passing-parameter-to-installutil.html 要进一步自定义值,还应该可以覆盖servive的BeforeInstall事件中的设置,如下所示: http ://dotnetstep.blogspot.de/2009/06/passing-parameter-to-installutil.html

See also the msdn article for the ServiceProcessInstaller.Account Property. 另请参阅ServiceProcessInstaller.Account属性的msdn文章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM