I am about to develop a program which will be installed and run as a Windows Service on the back-end servers (with internet access) of several clients. I do not have physical access to the servers. What I am working on is a scheme for reliably rolling out updates to the program.
I have spend quite a lot of time looking for best practices for Windows Service auto-updates, but have found very little useful information. Most techniques, such as ClickOnce, seem to cater primarily for Windows Forms-based applications.
My current plan is:
Some important concerns for me are:
What am wondering is if this a common way to solve this problem and/or if I am missing anything crucial. Is it too complicated, or perhaps far too simplistic? How would you have done it (or, even better, how have you done this successfully)?
Thanks!
To check for updates manually, select the Start button, then select Settings > Update & Security > Windows Update >, and then select Check for updates.
Select Start > Settings > Update & Security > Windows Update . Select either Pause updates for 7 days or Advanced options. Then, in the Pause updates section, select the drop-down menu and specify a date for updates to resume.
On the Microsoft Update site, click Change Settings. Scroll down the page, click to select the Disable Microsoft Update software and let me use Windows Update only check box, and then click Apply changes now.
I was faced with the same problem last year and I wrestled with a lot of the same questions. A few bits of advice:
Since either service may be updated, both services will function as updaters of the other. Service A will update Service B and vice versa. For this reason, I suggest simply running both services at all times. Unless you are worried about really loading down your server with does-update-exist calls, the enable/disable service management isn't worth the overhead.
Like services can't be installed on a single machine. In other words, you can't install new and old versions of the service side-by-side if they have the same name. Unless you want to complicate your update process, I suggest you uninstall the old version and then install the new version. For example, Service A would download Service B Installer, uninstall Service B, install new version of Service B and then run. Service B would do the same for Service A.
Since each service is managing the other, they should not only check for available updates but they should verify each other's health. For example, Service A would check to see if Service B exists and if it is running. If the health check fails, a list of steps to resolve the issue and get the service running would be completed by Service A. Executing the health check and recovery operations will cover you now matter what issue arises with the update, initial install or general operations.
Do ample logging on both the client and the server. You'll want to track what actions were taken and when. For example, Service A might when it is checking for updates, when it is executing the health check and associated actions. On the service (assuming you are calling into a web service looking for updates) track the calls made by each Service. If your Services aren't getting updated at least you'll have a trail of breadcrumbs (or lack of breadcrumbs) pointing you to the problem.
There are literally bunches of potential gotchas with a solution of this sort: services not running at startup, UAC getting in the way, not being able to install and uninstall the services with the same user, ensuring user installing the service has ample permissions, connectivity loss, getting the .NET Framework installed on the client machine, handling reboot after install if necessary, etc.
Best of luck. It's a fun problem to solve, but it doesn't go without it's frustration -- especially since, as you said, there isn't a lot of documented information available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With