如何避免在"Windows服务"中出现用户名和密码提示安装程序帐户类型=用户[自动使用登录用户的凭据安装服务] [英] How to avoid username and password prompt in "Windows service" installer Account type = User [install the service with the credential of login user automatically]
本文介绍了如何避免在"Windows服务"中出现用户名和密码提示安装程序帐户类型=用户[自动使用登录用户的凭据安装服务]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何避免在"Windows服务"中使用用户名和密码?安装程序,帐户类型=用户.
我的要求是,帐户类型必须是User [不是本地服务,网络服务或本地系统,因为我的用户在其下运行我的服务必须是特定组的成员]
但在安装过程中,我想避免提示输入用户名/密码
我尝试在projectinstaller中使用以下代码,但无法获取密码,因此密码失败
How Ca I avoid username and password in "Windows service" Setup project with account type = User.
My requirement is such that Account type have to be User [not localservice, network service or local system as my user under whom my service run must be a member of particular group]
But during installtion I want's to avoid the prompt for username/ password
I have tried following code in the projectinstaller but I am not able to get password so it fails
/*public String GetContextParameter(String key)
{
if (this.Context == null
|| this.Context.Parameters == null
|| !this.Context.Parameters.ContainsKey(key))
return null;
return this.Context.Parameters[key].ToString();
}
protected override void OnBeforeInstall(IDictionary savedState)
{
base.OnBeforeInstall(savedState);
String username = GetContextParameter("username");
String password = GetContextParameter("password");
System.Security.Principal.WindowsIdentity objw = System.Security.Principal.WindowsIdentity.GetCurrent();
serviceProcessInstaller1.Username = objw.Name;
serviceProcessInstaller1.Password = ........;//don't know how to extract password
}*/
推荐答案
我认为您无法做到这一点.如果应用程序能够自行提取用户密码,将是一个很大的安全漏洞.
i don't think you can do that. It will be a big security flaw if an application is able to extract user password by itself.
这篇关于如何避免在"Windows服务"中出现用户名和密码提示安装程序帐户类型=用户[自动使用登录用户的凭据安装服务]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文