我写了一个账户,想在app.config中配置账户和密码,以达到指定账户启动服务
在ProjectInstaller.Designer.cs文件中,我发现只有使用System.ServiceProcess.ServiceAccount.LocalSystem
不会弹出输入账户的框框
好像并不能直接从配置文件中读取
我想达到这样this.FlashConverterServiceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.User;
this.FlashConverterServiceProcessInstaller.Password = ConfigurationManager.AppSettings["Password"];
this.FlashConverterServiceProcessInstaller.Username = string.Format(".\\{0}",ConfigurationManager.AppSettings["UserName"]);
请大家帮忙一下
在ProjectInstaller.Designer.cs文件中,我发现只有使用System.ServiceProcess.ServiceAccount.LocalSystem
不会弹出输入账户的框框
好像并不能直接从配置文件中读取
我想达到这样this.FlashConverterServiceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.User;
this.FlashConverterServiceProcessInstaller.Password = ConfigurationManager.AppSettings["Password"];
this.FlashConverterServiceProcessInstaller.Username = string.Format(".\\{0}",ConfigurationManager.AppSettings["UserName"]);
请大家帮忙一下
如果是安装程序,可以读取app.config,指定安装时使用的账户和密码,但是如果是服务程序则不行,服务一旦注册好,账户和密码也就设置好了,如果账户和密码错误,服务本身都无法启动,更谈不上设置启动用的账户了。