maybe you have slow internet and something is wrong with the code
Windows Service not really running after shutdown...

Morning
I've written a service in Visual Studio that manages a folder, so far, things work just fine until you shutdown the computer then start back up, the service shows that it is running but it actuality, its not as there are no event logs created from the service. Now the weird thing is when you physically restart the service or just simply reboot the machine, everything works as it should, logs are sent to event viewer and the services executes as it should. I've set the dependencies of the service with the event viewer to ensure that service is running prior to this service starting up. Its also running on a local system account. In the OnStart() event, its calling a backgroundworker class to read some information from a text file to set some variables the service needs then starts a timer. Like I said, everything runs fine except when you shutdown the machine.
Why would a service act this way on a hard start meaning showing that its actually running when its not.
3 answers
Sort by: Most helpful
-
-
Davido 0 Reputation points
2023-05-03T15:54:54.5333333+00:00 way out in left field...
One, service does not rely on internet what so ever, then two, if something was wrong with the code it would throw an error when it runs after a manual restart or a soft reset (known as a windows restart) as the same code is executed each time.
-
RLWA32 32,046 Reputation points
2023-05-03T16:21:20.9433333+00:00 @Davido, If your system is configured to use Fast Startup then the system does not stop services when you use shutdown. Instead, the system enters a hibernate state. Consequently, the next time the system is started its state is restored from hibernation which includes those services that were running previously. So from your service perspective, it was not stopped at shut down and is still running when the system state is restored at the next startup.