![](/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.