Principle: All version content is stored on the server, and only the latest version is stored, and automatic updates are performed according to version information. Related configuration: The server needs to set a virtual directory, which means to open the 80-port, and then put different versions of the program in different folders in the virtual directory. For example: "1.0.0.0," 1.1.0.1 "," 1.1.1.8 "in the virtual directory, then store three different versions of the program. The file below the root directory: 1, ServerManifest.xml File: The path where the current version is located, each time you need to update the file name and related certificate (encrypted decrypt). The key is used to encrypt the user's authentication and file encryption. There is a sub-part clip in the folder of the client to store the file, the name of the folder is the name of the last download version, for example: "1.1.0.0", stored in it The program file that needs to be updated, there are several files in the root folder: 1. AppStart.exe-> is used to start the automatic update 2, appstart.exe.config-> There are related configuration information A, program files Store B, currently the latest version number C, update the name D, last updated time 3, each updated log file, log file "Updatelog Annual Day Duration Di - second" Run step: 1, customer Direct operation, the program is started by an automatic updater. 2, the automatic update will check if the network is connected. 3, if the network is available, the program detects the current version of the program and the latest version on the server, if the same No update operation. 4. If the local program version number is smaller than the server version, then the dialog box will pop up, prompting the user's updated version on the current server, and ask if the user will be updated immediately. 5, if the user selects to start updating, Then first, the client is authenticated with the server. After the authentication passes, download the servermanifest.xml file from the server, find the location and name of the file you need to update, and verify the certificate. 7, after the authentication To create a "newfile" directory locally, the file that needs to download will be downloaded to this temporary directory. 8. After the download is completed, rename the folder with the new version number, and change the local configuration file 9, prompt the user Restart the program and delete the old version of the file update after confirmation. It is worth learning from: 1, all the operations are recorded in the log file, no matter whether it is successful, we can see what is what we have produced 2, many information use XML files to store, convenient. 3. Fully perform the user's verification and file authentication when performing updates, ensuring the security of the program. 4. A full process of abnormal conditions For example: When a user changes its local version information, the local version is more than the server, the program will Delete all local files. There is also an error when the operation has occurred, and the error will be written to the log file.