7

I'm trying to install my Windows Service app using Visual Studio 2008 Setup and Deployment project. I have created a user account that has "Run as a Service" right and have set the ServiceProcessInstaller.Account to System.ServiceProcess.ServiceAccount.User and also the username and password to the user that I have created previously.

spInstaller.Account = System.ServiceProcess.ServiceAccount.User;
spInstaller.Username = "USER NAME";
spInstaller.Password = "PASSWORD";

sInstaller.ServiceName = "SERVICE NAME";
sInstaller.StartType = System.ServiceProcess.ServiceStartMode.Automatic;

But during the setup process, I get the following error:

Error: 1001. The account name is invalid or does not exist, or the password is invalid for the account name specified

Any ideas why I get this error and how I can fix it? Thanks.

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
mrtaikandi
  • 6,753
  • 16
  • 62
  • 93

1 Answers1

18

Are you specifying a Domain for your UserName. I.e. if you machine is called FASTCAR have you tried

spInstaller.UserName = "FASTCAR\\UserName";
Eoin Campbell
  • 43,500
  • 17
  • 101
  • 157
  • do you know how to avoid the popup asking for admin user and pass ? – acromm Dec 10 '10 at 19:15
  • Good tip. works for me and I was just trying to enter it in the box at time of install. I hope the panda is no longer sad. – M3NTA7 Sep 28 '11 at 23:43