archaictree
archaictree

Reputation: 175

How do I get Topshelf to run as a domain user

How do I get Topshelf to run as a specific domain user account? I have in the configuration

x.RunAs("domain\username", "password");

I have in the code a console statement that prints out the Windows Identity that the process is running under. It is not the one I specified.

Upvotes: 4

Views: 4467

Answers (1)

Travis
Travis

Reputation: 10547

The code snip-it you indicated is the correct method to apply a user. A couple of things apply to this...

  1. This only works for windows services, if you run it as a console app it will still run as you
  2. All shelved processes run as the host user, so shelves will ignore any user settings
  3. You can double check the user the service is registered to run as by going into services in mmc, find your service, goto the properties panel, and there's a Log On tab which will display the user the service is to run under.

If you are just running as a console app, just servicename install start and it should be running as the user it's been setup for.

If this doesn't help, reach out on the mailing list http://groups.google.com/group/topshelf-discuss.

Upvotes: 3

Related Questions