Reputation: 1865
I have created a windows service that has the Account set to user. Which means that when I install the service I need to pass a user name and password. Is there a way to set these maybe in the ProjectInstaller class maybe in the BeforeInstall event? if so HOW?
Upvotes: 9
Views: 14355
Reputation: 61
The below addition to a project installer will assign the service Log On information during installation.
public ProjectInstaller()
{
InitializeComponent();
serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.<account type>;
serviceProcessInstaller1.Username = <domain\userId>;
serviceProcessInstaller1.Password = <password>;
}
Upvotes: 6
Reputation:
There is a bit about setting service parameters and stuff in A Windows Service without a template Its on page 5 in the bit about customising a service.
Upvotes: 0