Designing a client/server app to update client software automatically
I am designing an app using .NET 2.0 remoting. It has a single server and multiple clients which are workstations or laptops which may be on or off-line at any time.
Part of the design is that the server holds a copy of the client installer MSI. The plan is that for the first installation, the clients will be rolled-out using group policy, but that once installed the Client software will be automatically updated from the server every time the server copy is updated.
To do the transfer is technically easy in remoting, the server loads the update file using File.ReadAllBytes into a byte[] array, attaches it to a remoted object, then the client saves it using File.WriteAllBytes and uses Process.Start to commence the msi installation using /passive.
The design question is whether the update should be pushed from the server or pulled from the clients. Pushing from the server is faster, but leaves the disadvantage that the clients may be offline and may need to be updated at some random point in the future whenever they connect. Pulling from the client is preferable because it allows clients to update themselves automatically as and when they come online.
There are a great many ways to achieve this end, all of them give rise to versioning issues with the objects which are used in the remoting call and require subsequent versions to retain compatibility for the upgrading interfaces.
The main disadvantage of client pulling the file is that many clients may overload the server (the msi file to transfer is 5mb and there may be 200 clients) and although I could program the clients to retry until successful, on the server side there seems to be no simple way to schedule the number of remoting threads received because once I have loaded the packet and returned control to the remoting interface on the server side, there is no easy way apparent to determine how long the actual transfer of the data takes. I have considered a great many workarounds including limiting the actual connections by number over a period of tim开发者_高级运维e, but this will never reflect the actual working capacity of the LAN and would still not seem to be idea. I could probably use a custom channel sink to control the thread count (I already have a full set of custom sinks installed) but wish to avoid this if at all possible because that would have to be a last resort. I would prefer to keep the logic out of the channel sinks for simplicity.
Are there any well-known .NET apps that offer this type of automatic updates of data to clients which may be coming on or off-line at any time?
For a pre-built solution in .NET for keeping client versions of software up-to-date, ClickOnce, included with Visual Studio does a fairly reliable job. On application startup, the application will check if an updated version has been uploaded to a server. If a new version is present, it will automatically download the latest version and install.
For a relatively simple project, ClickOnce generally works very well and is extremely simple to get up and running. You'll save yourself the effort of writing the update checking code and the transfer code, and since it will run on IIS, your concerns about multiple users downloading are somewhat alleviated (it's still possible to exhaust your bandwidth, but IIS will do fine with a large number of clients).
精彩评论