How do Windows services behave when entering / waking from sleep or hibernation?

I have a service written in C # that does not seem clean when the computer goes into sleep mode. The user must manually stop and restart the service in order to maintain functionality. I know what the problem is, but I do not know where to fix it. How do Windows services work when entering / exiting sleep and hibernation?

+6
source share
1 answer

How do services respond to violent events? Actually it depends.

In your service, you can handle hibernate / suspend / etc events by processing them in your service

protected override bool OnPowerEvent(PowerBroadcastStatus powerStatus) { //do stuff here } 
+8
source

Source: https://habr.com/ru/post/919890/


All Articles