2

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 'jasper@catthoor.com' (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.

Jasper Catthoor
  • 595
  • 1
  • 6
  • 22
  • Have you heard about Topshelf project? – Matías Fidemraizer Aug 31 '15 at 07:43
  • 1
    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 Aug 31 '15 at 07:57
  • 1
    Is the machine joined to a domain? Is that a cloud account - "Microsoft Live" or whatever they're calling it now? – Harry Johnston Sep 01 '15 at 04:44
  • HarryJohnston i have the same problem and i'm on windows 10. This is a @live.fr , what do i do ? – julio Aug 03 '16 at 20:07

2 Answers2

1

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

Abhinaw Kaushik
  • 607
  • 6
  • 18
0

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.

RFerwerda
  • 1,267
  • 2
  • 10
  • 24