Specifying UserId Security for a Service with Whidbey

The install routine for a Windows Service will allow you to default the service to one of four user ids.

  • LocalService.
  • LocalSystem.
  • NetworkService.
  • User.

These values are provided by the enum System.ServiceProcess.ServiceAccount.

Typically, when I write a Windows Service, I will either run it as the LocalSystem or as a User.  If you run as the LocalSystem, don't forget to set the Username and Password properties of your ServiceProcessInstaller object to null.

Wally

No Comments