Questionaire
Questionaire

Reputation: 297

How to make Windows service become "Running" when the system boots

I know this has been answered here but I'm having a more specific issue. I did what was suggested by adding

serviceInstaller1.StartType = ServiceStartMode.Automatic;
serviceInstaller1.DelayedAutoStart = true;

and indeed I can confirm that after installing I see my service has Startup Type equal to Automatic (Delayed Start). However I restarted my machine and it doesn't have Status equal to Running like other services. I tried without serviceInstaller1.DelayedAutoStart = true; and same issue. I'm wondering if my Log On As needs to be something other than my domain account. Or what else could be the issue?

Upvotes: 0

Views: 125

Answers (1)

Rainer Schaack
Rainer Schaack

Reputation: 1618

First, I would check if the service starts with logon = SYSTEM. If that works, in my experience (big enterprise environment), the most common reason is that the user account under which the service is supposed to run does not have the privilege "logon as service". Look in the Windows security event log for logon errors. Depending on your environment you can use use a GPO for enabling this privilege or may set it yourself (via local security policy) if it is allowed in your Windows environment.

Or perhaps your service crashes in OnStart(), but this can also (as Brien and Shetty suppose) normally seen in the event log (application event log).

Upvotes: 1

Related Questions