My C# program running as Windows Service is blocking Windows XP from hibernation
        Posted  
        
            by sherpa
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by sherpa
        
        
        
        Published on 2010-05-16T13:38:59Z
        Indexed on 
            2010/05/16
            13:40 UTC
        
        
        Read the original article
        Hit count: 310
        
I have Windows Service written in C#. It starts two threads, one is pooling a Web Service, second is waiting on a Monitor object for a new job to arrive. Besides that, the main thread acts as a WCF service host using NetNamedPipeBinding. It lets the client application to register a callback and then sends notifications back. 
The problem I have is that when this Windows Service is running, I cannot hibernate or Standby my computer which is running on Windows XP, SP3. When I set Windows to hibernate or standby, nothing happens. Then, at the moment when I go to Service Manager and stop the service, the system hibernation starts immediately.
The service class extending the ServiceBase has properties like CanHandlePowerEvent, CanPauseAndContinue, etc. set to true... That didn't make any difference.
The question is: what can be blocking the Hibernation/Standby from proceeding? What should I take care about to avoid it?
© Stack Overflow or respective owner