I have a windows service and setup project. When I right click on the setup project and click install it prompt me for
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...
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).
Please cross check whether you have done the following steps (especially step 5):
After creating the windows service project go to the service class's design view(just double click the service1.cs class).
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.
Go to the design view of ProjectInstaller.cs you will find two installers there->
a.ServiceInstaller1
b.ServiceProcessInstaller1
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.
Right click ServiceProcessInstaller1 and go to the properties tab
a. Change the account to LocalService
Save and try it.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With