1
votes

I try installing my Windows service using InstallUtil.exe and running my command prompt as Administrator.

InstalUtil.exe WindowsService.exe /ShowCallStack

The above command opens a 'Set Service Login' window, see the picture at this link.

When I enter 'Jasper Catthoor' in the username field (my account name) and my windows password in the password fields, I get the following error:

System.ComponentModel.Win32Exception: The trust relationship between the primary domain and the trusted domain failed.

When I enter as username '[email protected]' (email of my account, see previous picture), I get the following error:

System.ComponentModel.Win32Exception: The specified domain either does not exist or could not be contacted.

By entering a random username I receive the same error as when I enter 'Jasper Catthoor'. By entering a random email (with an @ sign), I receive the error:

System.ComponentModel.Win32Exception: No mapping between account names and security IDs was carried out.

2
Have you heard about Topshelf project? - Matías Fidemraizer
Is that really your username? The username that you enter in there usually should look like COMPUTERNAME\USERNAME or DOMAINNAME\USERNAME depending on whether you are joined to a domain. (or USERNAME@COMPUTERNAME or USERNAME@DOMAINNAME; while an E-Mail address looks somewhat like this, unless your Windows domain is named catthoor.com that will not work). (Also please embed the images directly into your question - those of us behind corporate firewalls cannot see/open the links you added and they are additional hassle for all of us). - Christian.K
Is the machine joined to a domain? Is that a cloud account - "Microsoft Live" or whatever they're calling it now? - Harry Johnston
HarryJohnston i have the same problem and i'm on windows 10. This is a @live.fr , what do i do ? - julestruong

2 Answers

1
votes

Try taking your machine out of the domain and then re-add into the domain. Post that re-start your machine.

Also in your ProjectInstaller.cs file set the Account as LocalSystem. It should work. Hope this helps.

Regards, Abhinaw

0
votes

Does the service really require to run under your user account? You could also try to use the Local Service account which most of the service run under.

You can also try to set the account information in the Account property of the ServiceProcessInstaller.