I want to set the user account for Windows Service even before installing.
I am doing it by adding code in project installer.
this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.User;
this.serviceProcessInstaller1.Password = ConfigurationSettings.AppSettings[“password”];
this.serviceProcessInstaller1.Username = ConfigurationSettings.AppSettings[“username”];
Still its prompting for Username and password. Looks like the configuration file is not getting ready by the time the installation is done.
How I can i pull the username and password from configuration file instead of hardcoding it?
Well, I’m at a loss to say why the AppSettings values are not readable in the traditional manner while the installer is running. I tried it myself and ran into the same problem you are having. However, I was able to get around the problem by loading the configuration file as a regular XML file and reading it that way. Try this: