Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Windows Service - No mapping between account names and security ID's were done

Tags:

I have a windows service and setup project. When I right click on the setup project and click install it prompt me for

  • Username
  • Password
  • Confirm Password

I have tried the following combinations

.\MyUserName MyDomain\MyUserName

but it comes back with the following error

No mapping between account names and security ID's were done

ServiceProcessInstaller

namespace TestService {     [RunInstaller(true)]     public partial class ProjectInstaller : System.Configuration.Install.Installer     {          public ProjectInstaller()         {             InitializeComponent();              this.serviceProcessInstaller1.Account = ServiceAccount.User;             this.serviceProcessInstaller1.Username = @".\MyUserName"; //username;             this.serviceProcessInstaller1.Password = "123456"; // password;              // Add installers to collection. Order is not important.         }          private void serviceInstaller1_AfterInstall(object sender, InstallEventArgs e)         {          }          private void serviceProcessInstaller1_AfterInstall(object sender, InstallEventArgs e)         {          }     } } 

To be honest, I'm not even sure why I am prompted for a username and password if I set it in the code...

like image 656
chobo Avatar asked Jun 16 '11 16:06

chobo


People also ask

What does no mapping mean?

The error message “No Mapping between account names and Security ID was done” pops up when there's a bad mapping between account names and security IDs in a domain. It occurs in the Microsoft Windows AD Group Policy (Active Directory Group Policy).


2 Answers

Please cross check whether you have done the following steps (especially step 5):

  1. After creating the windows service project go to the service class's design view(just double click the service1.cs class).

  2. In the design view right click and select Add Installer. This will create an Installer class named ProjectInstaller.cs. With out ProjectInstaller.cs or any error in configuring ProjectInstaller.cs may result in non-showing of the service in service console.

  3. Go to the design view of ProjectInstaller.cs you will find two installers there->

    a.ServiceInstaller1

    b.ServiceProcessInstaller1

  4. Right click ServiceInstaller1 and go to the properties tab

    a.Edit the ServiceName with the name you want to see your service in the service console.

    b.Change the StartType to Automatic.

  5. Right click ServiceProcessInstaller1 and go to the properties tab

    a. Change the account to LocalService

Save and try it.

like image 116
Harun Avatar answered Sep 30 '22 20:09

Harun


Your DOMAIN\USERNAME format is correct for a domain, but if you're using a local username, use the computer name for the domain name. If your hostname is FOO and your username is BAR, you'd use FOO\BAR.

You're sure your user account is allowed to escalate, right? It's possible to forbid that via network and local security policy.

Try it with an admin account if it doesn't work.

like image 33
djdanlib Avatar answered Sep 30 '22 19:09

djdanlib