Image

Development

How to process the PreShutdown event in a managed Windows service

If you liked the post about Hyper-V guests in different time zones, here is one more article that comes from our development work on the new OpenStack and Hyper-v based setup of Atomia Hosting Platform.

Several of our products ship some windows services which we use to do periodic background tasks. For example, Automation Server uses a service to perform long-running automation tasks. During a system shutdown, it is important that the service has enough time to cleanly exit and not be terminated in the middle of some complex operation.

Whereas Windows will not shutdown until all applications in the user’s session are properly closed, this does not hold true for services, which only have 12 seconds to process a Shutdown notification, which might be too short for your service. The good news is that Microsoft introduced the PreShutdown event for services in Vista, which you can use in your service’s code to get 3 extra minutes (or even more) to shutdown your service.

Read more on how to develop your service’s shutdown behavior after the break.

Read more

Social

Follow us on Twitter

Like us on Facebook

Visit us on LinkedIn

We share the latest news about Atomia, event photos, and more.

Contact

[email protected]

+46 21 490 2620

Hamngränd 6,
721 30 Västerås,
Sweden

Work at Atomia

Would you like to join our quest to provide the ideal hosting platform? Be part of a fun, dedicated team and work with some of the coolest companies in the hosting industry. Check out our job page.