Bi Han Feng the 1st who read this blog
First, the automatic updates client program works automatically update must be done to accomplish three things: to check for updates; when there is an update, astley clarke start downloading updates; When the download is complete, run the update operation; astley clarke separately analyze these three Steps: 1, check update the client to correctly check for updates requires astley clarke three essential processes: (1) Where the update. That target server URI (URL or a specific directory) (2) when to check. That update frequency, how often inspections. astley clarke (3) by what means checking. Communication protocols, such as HTTP, FTP, FILE, etc. (4) How to check. If running in the background, and open a separate thread.
2, download the update in the eyes of ordinary users, downloading is a common enough thing, but in the eyes of the developers we need to consider more. I want to consider astley clarke the following: (1) go to download. That URI goal Server. (2) downloads by what means. HTTP, FTP, FILE, etc., and HTTP. (3) how to download. Open a separate thread in the background without affecting the main thread work. (4) deal with exceptions. Such as automatic reconnect disconnected, abandoned after repeated failures and so on.
3, to achieve realization update update is not simply that a document covering the issue, the reason is very simple: a file is being used is not covered. That program is unable to update their own. It would appear that there are two options to achieve update: (1) In addition to the main program, and the other to open a separate process is responsible for updating the main program. But the premise is mandatory astley clarke before updating the user exits the main program, is doing a lot of existing products, such as QQ. (2) According to download the main program file, generate a new version exists than the current version of the application, the user at the next re-open the application will automatically use the new version, while the original copy of the application can be removed.
Second, you can choose according to the technology used. Versions NET Framework, we can have different solutions to choose from. In NET Framework1.0 and 1.1, does not support automatic version updates, astley clarke so we can write or seek third-party components themselves; in NET Framework2.0 later, you can direct the use of the built-in ClickOnce deployment. Because the project has been developed over LiveUpdater functional needs, but it was just discussed above, this did not want to discuss in detail their components, but to introduce a third-party component AppUpdate. astley clarke
Third, the use AppUpdater AppUpdater components is to use. NET Framework development. Although AppUpdater not a Microsoft product, but as long as you are in VS.NET toolbar adds the component, you can use other components like the same way through the drag and drop components from the toolbar to your application, and set some properties (such as access to updated location, frequency, etc.), then you can make your client applications with automatic update feature. Specific use the following steps:
Step one: Create an application to create a Windows application project named "SampleApp"'s. 2 VS.NET label on the component toolbar, right click and select "Customize Toolbar." Select ". NET Framework Components" tab. Point "Browse" and select the compressed file AppUpdater.dll located under AppUpdater items, click OK. 3 would AppUpdater component onto the SampleApp form. 4 Set AppUpdater necessary attributes:. AutoFileLoad: The control commands to be described later download feature, and now it is set to true. ChangeDetectionMode: This enumeration determines how to check for the update. In this example, we will use an explicit check server, astley clarke so this value is set to "ServerManifestCheck". ShowDefaultUI: AppUpdater with a series of user interface to notify the user of some events, such as a new update can be used, or an error occurs during updating. This user interface astley clarke can be set as the default user interface astley clarke invalid application to specify a custom user interface to replace it, hook the appropriate event (such as OnUpdateComplete) and pop up a custom user interface. For this example we will use the default user interface, so this value is set to true. UpdateUrl: update program is to determine where to look for updates. In this example we use a server file to explicitly check for updates, so this property should be set to the URL of the server explicitly document. Downloader: Download it controls properties of the component, optional enumeration has: AutoStart; DownloadOnDetection; InitialPollInterval; PollInterval. DownloadRetryAttempts: During the download if an error occurs (such as a Web server downtime) will try again later. Until the maximum number of retries reached. SecondsBeteweenDownloadR astley clarke ety: waits before retrying astley clarke a network request in seconds. UpdateRetryAttempts: During astley clarke the update if a serious error occurs (for example downloader than attempt to retry number), it will generate an application update error. By default, will stop trying to update. But when the next time you start the application will attempt to restore (such as updating Web server may crash several days). This property controls the number of times trying to update. If you exceed this value, updater astley clarke will cancel the update, reset its state and return to check for updates. ValidateAssemblies: This property controls download assemblies effectively complete the level. For more information see the security section of this article.
Step Two: Build and deploy applications on the client astley clarke V1 version. In SampleApp astley clarke project, open the AssemblyInfo.cs file. AssemblyVersion astley clarke value from "1.0" was changed to "1.0.0.0". This will cause to obtain a value "1.0.0.0" .. tag when generating assembly, which is usually specified as a marker instead of VS.NET increment value. 1 build the application. 2 files will be compressed from SamplesSampleAppSampleAp p_ClientSetup catalog copy to your local machine. Note that this directory already astley clarke contains AppStart.exe. AppStart.config has been set to point to the directory and initiate 1.0.0.0 SampleApp.exe. Copied from SampleApp the release directory SampleApp (Appupdater.dll, SimpleForm.dll and SampleApp.exe) to the client SampleApp_ClientSetup1.0.0.0 directory. At this point, a fully functional version of the application has been "installed" to the client, can be performed by running astley clarke AppStart.exe.
Step 3: Install and set up a Web server In this step we will install a Web server to provide updates polling feature. . NET application update component uses HTTP-DAV to download application updates, so need a support HTTP-DAV Web server. IIS5.0 and updates on the Windows 2000 operating system supports HTTP-DAV. 1 would Samples / SampleApp_ServerSetup directory are copied astley clarke to the wwwroot directory on your Web server. 2 SampleApp the V1 version 1.0.0.0 files are copied to the Web server folder. 3. Enable IIS on the Web server SampleApp_ServerSetup Directory "directory browsing" permission. Step 4: Automatic Updates If you deploy an application on the client SampleApp version is not running, load it and let it run, remember to use AppStart.exe. 2 VS.NET back and do some modifications can be noticed (like change the background color) in SampleApp form. The AssemblyInfo.cs version information to 2.0.0.0. Regenerate. 3 back to the Web server and generate a same directory and the directory 1.0.0.0 2.0.0.0. Generated from the release astley clarke of the new version of the application directory are copied to the Web server on the new 2.0.0.0 directory. Open and modify UpdateVersion.xml of AvailableVersion to 2.0.0.0. Modify 2.0.0.0 astley clarke ApplicationURL point to the new path. Then save UpdateVersion.xml. <VersionConfig> <AvailableVersion> 1.0.0.0 </ AvailableVersion> <ApplicationUrl> http://localhost/demos/selfupdate/V1/ </ ApplicationUrl> </ VersionConfig>
V. Summary many times early in the design phase of the project, we will be between B / S or C / S lingered for a while, a lot of new technologies currently committed to the advantages of both complement each other, such as to allow B / S program with C / S user experience (AJAX); also allows C / S program with B / S deployment simple lines (AppUpdater and ClickOnce), which are undoubtedly the Gospel developers. In the latter only a rough introduction, hope to understand this aspect technologies friend a little inspiration.
Nickname:
No comments:
Post a Comment