Reputation: 4516
I created a service using .NET that is supposed to start automatically and run as a User with my username & password.
If I restart my PC, log on with the same username & password, and go to Task Manager, it says that the service is running, but when I check the Event Log there are no messages stating that the service has started, and in fact, the service has not started, because it doesn't do what it's supposed to be doing.
On the other hand, if I manually stop and start the service, then the entries in the Event Log appear and the service runs as it's supposed to.
So when I restart my PC, how come Task Manager says that the service is running even though it's not running? Is there a security setting that I need to tweak?
Upvotes: 0
Views: 1337
Reputation: 4516
I was able to solve the problem: the service was failing to initialize properly on windows restart because it was not dependent on any service, when it should have been dependent on the event log service. Setting the "ServicesDependedOn" property of the ServiceInstaller object to "Windows Event Log" solved the problem. Thanks for the help!
Upvotes: 1
Reputation: 62472
Does your service have a dependency on another Windows service? If so then it may be that your service is failing to initialize correctly when the machine restarts as it can't make use of the functionality in needs from the dependent service.
This would explain why if you restart the service is works correct.
Upvotes: 1