A simple way to keep all your fat client or single user applications up to date, easy to add to your projects and much easier than any other product to put online an update!
C#, Windows, .NET, Visual Studio, Dev
Posted: 10 Mar 2006 Updated: 26 Apr 2006 Views: 59,397 Bookmarked: 144 times
Automatically deploying your applications/resources/related files is a common and recurring problem that every developer making software for a large audience has to face! WebUpdate offers a real easy and fast way to add a self-update ability to your application!
Update any kind of file based on date check
Each file can be updated individually (no need to redownload a full version if only one little file has changed)
No need to make a configuration file and specify manually each file that requires an update
All communications between the client and the Web service (the webupdate server part) are compressed to gain up to 60 % of bandwidth and update time!
Threaded
Reconstructs files and directories that have been deleted by the user
Easy to add to any project (less than 5 minutes!!!)
Easy to add a new update (put or overwrite files to be added/updated in the update folder on the server)
Automatically starts at startup or shutdown of your application
The block relies on absolute path links being provided in the configuration file. This reliance causes big problems, because you can't always guarantee that users will install your application to a specific location.
When you want to add a new file to be updated, you have to modify a manifest file to set the file path for each file!
You have to play with a public/private RSA key. :(
A version is a set of files. So, if you want to update just one file you have to prepare a new update folder with a new manifest!
Every time the Updater downloads a new version of your application to the client, it creates a new folder to contain the new version; unfortunately, it leaves the folder(s) for the outdated version of your application and all its files intact. That's untidy. It leaves open the possibility for users to run an older version, and bloats the disk space requirements for your application.
Hopefully those limitations can be removed by extending the updater block with the interfaces IValidator, IPostProcessor and IDownloader but that is not the subject of this article.;)
The Update Process
A user starts your application, your application launches WebUpdate.exe. WebUpdate asks the update server if WebUpdateClient.exe was updated and updates it if necessary. Webupdate.exe starts webupdateclient.exe which is the real updater. WebUpdateClient asks the server (a Web service installed on a Web server) for all file info about an appname (paths, sizes, last modifications) and compares the results to the local folder. Finally WebUpdateClient.exe asks for the required files. The server sends in response the required files through a compressed soap message. All updated files are updated or added to the application folder.
Using the Code
Given below is the code to add to your existing application Load method:
Create a virtual Web site for the folder WebUpdateWS
Place some files to be updated or added on all clients computer in the folder WebUpdateWS\Updates\YOUR_APP_NAME_HERE\
Edit the webupdateclient\bin\Debug\WebUpdate.ini file and set the line "Version=" to "Version=YOUR_APP_NAME_HERE"
You can directly run a webupdate by launching webupdateclient\bin\Debug\WebUpdate.exe
Of course in a real application, you just need to xcopy all the contents of webupdateclient\bin\Debug\ near your main EXE and modify WebUpdate.exe.config and WebUpdateClient.exe.config to set the real Internet webupdate server HTTP address.
Your user should start webupdate.exe, this will update webupdateClient.Exe and start your application update then you can modify webupdateClient.exe to start your application.exe at the end of the update
Thanks for providing WebUpdate, its a simple and effective solution for my updating needs.
I made a change to include the file's md5 hash as a field in the UpdateInfos class and I use that now instead of the file time to check if a file needs to be updated. The reason for this was that when uploading a new version to the website folder the ftp client affected all the files times so all the files would be downloaded instead of only the ones that had really changed.
I'm very sure that I am correctly doing the code changes that you have previously posted about what to modify after VS2005 does it's upgrade; but I'm still having problems. I've tried from scratch 3 times now with no luck. So, any chance you could post your VS2005 version as clearly there is something else going on?
nice work! But it´s not working here. I´m sitting behind a Proxy Server. Each time i start the client i´m thrown out with the exception "...407: Proxy Authentication Required."
Any idea where to put my login/pw for my WWW-Proxy and why i´m asked for this ? The HTTP server is running local.
you'll have to edit sources and add just after the instanciation of the webservice a line where your configure the proxy for the webservice, optionally you can externalize the proxy settings in the config file
I dont know if I'm doing something wrong, but I receive a soap exception on this line:
object[] updates = upd.GetAllUpdateInfosCompressed( version );
Error: System.Web.Services.Protocols.SoapException was unhandled Message="UEsDBBQAAAAIAAhH7DYILLmESgEAAD8DAAAKAAAAWmlwcGVkRmlsZa2SPU/DQAyGdyT+gyeUSuSmqgNsjVrBUFE1IAbE4CamjUjOwXf9gF+Pr/koYkB8DZEvd/Zj33tv+uo8VeaeliYl2RYZOTMX9pxx6UzKWE/2GdW+YHsBIYMEduhgY3FZEniGWliLHAi9bMh5A3Ecn638JbToKUuF/gPl2m6xLHLI1iiYeQUWFhDG6CgeDcF5KezKnJ4AAPqOkrDV1t5MhauQORqmh7yoCeAGXcEMtUCSVOl1uFd/rYSrWnRSHWKy92TDwtzZt6LuIYdwy4fNvwCDbgFKWAWohn+ARr8snjcPNNMPVxSF2do1VE0cfBL7Cze0lWaxOXZwUeOT9vfhEag/Oocxc0lowa+Fdze2N8IPmja+6/bMgjCfq3cqUhVc9E3QUacrtHlJomoJteIsGvO2LHUwTGwO/KTWtGpQ6obW18TsGbwal0LaO1BLAQIUABQACAAIAAhH7DYILLmESgEAAD8DAAAKAAAAAAAAAAAAAAAAAAAAAABaaXBwZWRGaWxlUEsFBgAAAAABAAEAOAAAAHIBAAAAAA=="
Please can you compile this in 2.0 and re-upload for us?
Your solution looks like its just what I'm looking for. Too bad it's .net 1.1 but I'm downloading it anyway an will post back here if I have any issues converting it.
I've read the previous comments and it seems that there are some issues for other people who have tried to convert it. Might I suggest you compile it to 2.0 and add another link so that people can download both versions if they wish.
I'd like to modify the interface of the updater a bit to match the rest of my application. I'm at work at the moment so I'll test it when I get home tonight.
You wouldnt perhaps know of an easy to use library which I can use to allow users to validate their copy of my software. What I mean is you can download my app and use it for free for 30 days, after which you have to purchase a cd-key. I'd like to limit it so that the application can only run on the pc the cd key was requested from. I've seen alot of articles covering this but like other auto-updating solutions if found before this solution of yours, are really over complicated.
I run the update application successfully before. but today When I debug the code to the project "BootStrap", method "GetNumberToUpdate" , code
" WebUpdate.ws_update.Update upd = new WebUpdate.ws_update.Update(); object[] updates = upd.GetAllUpdateInfosCompressed( version ); "
An exception was thrown out:
System.Web.Services.Protocols.SoapException: UEsDBBQAAAAIAGqCqzazTWNvdwEAAF0DAAAKAAAAWmlwcGVkRmlsZa2Sz0sCQRTH70H/w5xiPeycxEPdEqUOgrhFh+gw6cMkd2ebGcU6hZVIEAQhUgQZREgk/Tq4UPTP5Kz2XzSjq0aHKOswvDfvzfcz8948a5sLsPEKrGMLWDGXBo6TjAqapnmOLUrcWCkNrshRZxb550fy8FKeNv16w3+qyav97nGld9f2H8pvu2VkmuZMVsyhgBmnzCbik3yecDAjYSRb9e7tdcd77Hit7tm+htWqg6DCTE8hhIgYUqLUKQITOM6orQGRsCVYzskaA4N4aChIECVgUWuDMFcXNKonSm2XAefqEbGSAEc7eNnZybkjSN8s0X7wL0DdMA0FYmuoMv8ANSYUq39UOZ5Qi2TB0G8LfGQPbOhLs78Zg0CJU4XxDdwYDEiwXV1DMEr9Aq3DwIYxnAKSSRJGbFC1cuOHoHE3FoiTyQPDi06RbsLk+ihlELQwBVsF4CJgqTlHsnLwvteUL2XpebJR8RvVXvui592oee4+n8j7V33qA1BLAQIUABQACAAIAGqCqzazTWNvdwEAAF0DAAAKAAAAAAAAAAAAAAAAAAAAAABaaXBwZWRGaWxlUEsFBgAAAAABAAEAOAAAAJ8BAAAAAA== at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at WebUpdate.ws_update.Update.GetAllUpdateInfosCompressed(String version) in C:\Documents and Settings\Administrator\桌面\WebUpdate_src\BootStrap\Web References\ws_update\Reference.cs:line 44 at BootStrap.Form1.timer1_Tick(Object sender, EventArgs e) in c:\documents and settings\administrator\桌面\webupdate_src\bootstrap\form1.cs:line 226 at System.Windows.Forms.Timer.OnTick(EventArgs e) at System.Windows.Forms.Timer.Callback(IntPtr hWnd, Int32 msg, IntPtr idEvent, IntPtr dwTime)
I have seen in the method "Do()" of your class "Thread", where some web methods of your webservice have been called, you have set timeout = (1000 * 60) * 15 in only one case and in other case you did not limit the timeout. Why did you define the limit for timeout only in one case? You raised the limit! I think the default timeout for the waiting is 100.000 MS
Hi! I tried only WebUpdateWS with IE. I get only filepath and time and no version information about an assembly, which is intended to download, as following:
This is NORMAL lol, webupdate is based on time comparison to be able to update not only assemblys and exe but any kind of files !!!! READ THE ARTICLE !