Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
WiX 3.6: A Developer's Guide to Windows Installer XML

You're reading from   WiX 3.6: A Developer's Guide to Windows Installer XML An all-in-one introduction to Windows Installer XML from the installer and beyond

Arrow left icon
Product type Paperback
Published in Dec 2012
Publisher Packt
ISBN-13 9781782160427
Length 488 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (23) Chapters Close

WiX 3.6: A Developer's Guide to Windows Installer XML
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Getting Started FREE CHAPTER 2. Creating Files and Directories 3. Putting Properties and AppSearch to Work 4. Improving Control with Launch Conditions and Installed States 5. Understanding the Installation Sequence 6. Adding a User Interface 7. Using UI Controls 8. Tapping into Control Events 9. Working from the Command Line 10. Accessing the Windows Registry 11. Controlling Windows Services 12. Localizing Your Installer 13. Upgrading and Patching 14. Extending WiX 15. Bootstrapping Prerequisites with Burn 16. Customizing the Burn UI Index

Service recovery with Util:ServiceConfig


Windows allows you to set actions to be taken if your service fails at some point while it's running. Note that at this point, we're handling errors that crash the service during its lifetime and not errors during the installation. Your three options are: try to restart the service, run an executable file or script, or reboot the machine. You can see these settings in the services management console by viewing Properties of your service and clicking on the Recovery tab.

First, let's alter the original Windows service that we created by changing the WriteToLog function so that it throws an error the third time it prints a message. As this error is uncaught, it will cause the service to stop running. This will give the failure recovery actions a chance to kick in. The following is the new code for WriteToLog:

protected void WriteToLog()
{
   int count = 0;

   string appDataDir = Environment.GetFolderPath(
      Environment.SpecialFolder.CommonApplicationData...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image