Updater Application Block automatic update Implementation solution [Source Code]

Source: Internet
Author: User
Overview

This solution uses Updater Application Block (UAB) for short. It is based on an automatically updated component developed in the early stage of Microsoft patterns & Practices (Mode & Practice Group) and extends multiple functions in more practical scenarios, to implement Client ApplicationsProgramOr Web applications can automatically update online.

Background

With the continuous expansion of business, products have begun to be deployed in all provinces across the country. At the same time, the implementation and customer service departments are under great pressure, and the implementation cost is also increasing. In addition to improving product quality, we need to solve an urgent problem: Uniform version, reducing implementation difficulty, improving implementation efficiency, improving customer satisfaction, enhancing product competitiveness and the competitiveness of the company's operations, achieve sustainable development.

 

Solution Introduction

In order to further support the business expansion of ECI, to cope with the problems faced by the current implementation, to meet the needs of timely updating the versions of various systems across the country, through the establishment of an online automatic update system, the system deployed in various regions can be maintained with the latest version without human intervention, automatic upgrade, and version unification.

Project objectives

By automatically updating the system online, you can achieve the following goals:

    • Unified versions of various systems (Latest Version)
    • No Manual updates required
    • Database updates
    • Half of implementers
Difficulties

To achieve automatic online update, the following technical difficulties must be solved:

    • Network Environment: How to penetrate the firewall.
    • How to confirm version consistency

Features

Supports updates to Windows (C/S) applications or some components

Supports Windows service updates.

Supports web application updates

Supports ms SQL and Oracle Database updates through SQL scripts

Supports executing custom command scripts

 

Implementation Framework

Source codeAfter the server release version is packaged, It is copied to the online update server. After some configurations are modified, the client automatically monitors the release of a new version, starts downloading, and updates and deploys the application.

 

Technical Framework


The update process is as follows:

1. The application detects updates through applicationupdatermanager.

2. applicationupdatermanager uses manifestmanager to download the XML list

3. downloadmanager transfers files using bitsdownloader

4. activationmanger uses activationprocessor to activate the file version

 

Manifestmanager

Manifestmanager is used to read the XML Update Configuration list of the server.

The configuration of the role is edited by manifesteditor.exe.

Supports Association updates for multiple configuration lists.

The manifestid needs to be re-generated for each update. The client matches the manifestid to determine whether the manifestid needs to be updated.

Bitsdownloader

The backend smart Transmission Service (BITs) uses the remaining bandwidth for bits file transmission. For example, if you currently use 60% of the bandwidth, bits will only use the remaining 40%. When the network is disconnected or the computer needs to be restarted, BITs can also maintain file transmission: After the network is reconnected successfully, bits will continue to be transmitted from the disconnected location.

Note: bits 1.0 is included in Windows XP and can only be downloaded. Bits 1.5 is included in Windows Server 2003 and supports downloading and uploading. Version 1.5 is available when Windows Server 2003 is released. Internet Information Service (IIS) server and bits server extensions must be installed for upload.

It is a good solution to the problem of network loans and is released through IIS, so it solves the problem of network firewall.

Activationprocessor

The operation that is performed after the update package Update file is downloaded to the local client.

Function list

Name

Function

Extension

Cmdscriptprocessor

Execute Command Script or batch processing

Custom

Sqlscriptprocessor

Execute an SQL script

Custom

Unzipprocessor

Decompress the ZIP file

Custom

Filecopyprocessor

File copy

 

Filedeleteprocessor

File Deletion

 

Foldercopyprocessor

Directory copy

 

Folderdeleteprocessor

Directory Deletion

 

Gacutilprocessor

Deploy or uninstall the DLL in GAC

 

Installutilprocessor

Deploy or uninstall Windows Services

 

Msiprocessor

Deploy or uninstall the installation package

 

Uncompressprocessor

Decompress the cab file

 

Validatehashprocessor

Verify the hash value

 

Waitforapplicationexitprocessor

Start update program after exiting

 

Case 1

Release the Web update package and execute simple SQL scripts.

Procedure
    1. Deployment Server

      Create a new virtual directory, such as http: // localhost/Updater. The corresponding server path is D: \ updateserver \ release \. Set the access permission;

    2. SourceCodeThe server obtains the source code of the latest version. After compiling and releasing the Web site, to avoid overwriting the local configuration file (web. config), and add the SQL script to be updated. compress and package through WinZip/WinRAR
    3. Copy the packaged Update file to the D: \ updateserver \ release \ directory.
    4. Start configuration and add the file to be updated

      Configure activation process. First, extract the file to the target path.

Execute an SQL script

Finished

    1. Client code, the simplest way to write

// Get the Updater Manager

Applicationupdatermanager
Updater=Applicationupdatermanager.Getupdater();

// Check version

Manifests=Updater.Checkforupdates();

// update the application as per manifest details.

Updater . download ( manifests , timespan . maxvalue );

// Activate process.

Updater.Activate(Manifests);

Summary

Client development is a relatively fixed step, and how to control the processing of the client is completely dependent on the configuration information of the server-side manifest, while downloading the Update file is also relatively fixed, it is nothing more than bits or HTTP, or FTP, but there are a lot of processing to be done for subsequent downloading to a local update package, such as commonly used, you can use directory copy to back up source files. For complex updates, you may need to execute scripts or install services. Fortunately, UAB provides many convenient extension methods, it is very convenient for custom development of some activation processor.

RealPlan Implementation

Dwonload UAB

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.