Can a service abort system shutdown?

  • Thread starter Thread starter Roshan
  • Start date Start date
R

Roshan

Hi,

Is it possible for a windows service to abort a system shutdown? By
registering for the shutdown event with the SCM (by setting
System.ServiceProcess.ServiceBase.CanShutdownproperty to true), the
service is notified of a system shutdown. But the service has only
about 30secs to finish processing. Is it possible for a system service
to abort the shutdown? (Something like what a windows application can
do by handling SessionEnding event).

Thanks,
Roshan
 
Roshan said:
Hi,

Is it possible for a windows service to abort a system shutdown? By
registering for the shutdown event with the SCM (by setting
System.ServiceProcess.ServiceBase.CanShutdownproperty to true), the
service is notified of a system shutdown. But the service has only
about 30secs to finish processing. Is it possible for a system service
to abort the shutdown? (Something like what a windows application can
do by handling SessionEnding event).

Thanks,
Roshan

No, you can't prevent system shutdown, if you don't return from OnShutdown
your service will be killed after the time-out anyway. Note that v2 of the
framework makes it possible to extend this time-out period, but for v1 yo
can't do this.

Willy.
 
Back
Top