Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practice for writing a self-updating windows service [closed]

We need to create a windows service that has the ability to self update.

Three options spring to mind,

  1. a second service that manages the retrieval, uninstallation and installation of the first service.

  2. Use of some third party framework (suggestions welcome. I believe .NET supports automatic updating for windows forms apps, but not windows services)

  3. Use of a plugin model, whereby the service is merely a shell containing the updating and running logic, and the business logic of the service is contained in a DLL that can be swapped out.

Can anyone shed some light on the solution to this problem?

Thanks

like image 960
Ben Aston Avatar asked Oct 22 '09 15:10

Ben Aston


People also ask

Can a Windows service update itself?

You can't have a service update itself because the . dll that is running will not stop. Seperating the business logic layer would be a good option. You could also rewrite the main service to run under reflection by a master or control service.

What is the name of the service associated with Windows Update?

Windows Server Update Services (WSUS), previously known as Software Update Services (SUS), is a computer program and network service developed by Microsoft Corporation that enables administrators to manage the distribution of updates and hotfixes released for Microsoft products to computers in a corporate environment.

How do I push Windows updates?

If you want to install the update now, select Start > Settings > Update & Security > Windows Update , and then select Check for updates. If updates are available, install them.


1 Answers

Google have an open-source framework called Omaha which does exactly what your point 1. describes. It runs as a scheduled Windows task in the background, outside the applications it manages. Google use Omaha to auto-update their Windows applications, including Chrome. Because it comes from Google, and because it is installed on every Windows machine that runs Chrome, Omaha is extremely powerful.

There is an article online that explains in more detail how Omaha can be used to update Windows Services. It argues that Omaha is an especially good fit for Services (vs., say, GUI applications) because of its asynchronous nature.

So you could do your points 2. and 1. by using Omaha. I'm afraid I don't know how you would do 3.

like image 146
Declan Nelson Avatar answered Sep 19 '22 14:09

Declan Nelson