Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run service as specified user

Status
Not open for further replies.

sunaj

Technical User
Feb 13, 2001
1,474
DK
Hi,

I've followed the steps in to create a windows service. If I run the service as 'LocalService' as suggested in the walkthrough, I get an 'JIT compile error - access denied' when I start the service. I could probably fix that with some framework security settings. If I run it as 'LocalSystem' it works fine. What I really want to do it run it as 'User'. If I do that, I'm prompted for the user name and password during installation of the service. However, I get 'The account name is invalid og invalid password ...' when I type the password. I've tried with both a local user and a domain user. Both users are local administrators.
If anybody has any suggestions to how to dig into the problem, please shoot...

thx in advance.

Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Problem solved. I did not supply the domain, which is mandatory.
You can also hardcode the user into the projectinstaller's constructor:
Code:
public ProjectInstaller(){
    // This call is required by the Designer.
    InitializeComponent();
    serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.User;
    serviceProcessInstaller1.Username = @"DOMAIN\username";
    serviceProcessInstaller1.Password = "pwd";
}

Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top