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

30,585

Solution 1

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.

Solution 2

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.

Solution 3

I found a remedy for this situation----however I am using VM WARE cloned 2008 r2's.

Change the SID on the Server 2008 R2 in question using the following steps:

http://www.brajkovic.info/windows-server-2008/windows-server-2008-r2/how-to-change-sid-on-windows-7-and-windows-server-2008-r2-using-sysprep/

This helped me remove the error.

Solution 4

Just add the configuration code below in InitializeComponent method installer.

this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
Share:
30,585
chobo
Author by

chobo

Updated on February 26, 2020

Comments

  • chobo
    chobo about 4 years

    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...