[Original] automatically update program 1-website deployment (Technology: spring.net + three-tier architecture + webservice + IrisSkin2 skin-over

Source: Internet
Author: User

Because the software in charge of work involves a wide range of areas, it is very troublesome to change the software each time. The one key click that comes with Microsoft has never been very fond of. It may be partly because the key needs to be processed by itself, otherwise, the validity period is not long enough. Another reason may be that every time this item is released, it is very troublesome. If the Error Path is difficult to find, the software has long abandoned the one key click method, now setup is used for installation, but the problem arises. After installation, the upgrade is a problem. This article focuses on the setup upgrade. The main implementation is as follows: when the main program starts the update program, the update program obtains the files under a directory of the server through webservice, and then downloads the files to the root directory of the main program in batches, decompress the package and restart the program.

Therefore, this article explains from the following two aspects: 1. Deployment of webservice; 2. Description of update programs.

The main program diagram is as follows:

BLLImpl

Public class LoadInfoServiceImpl: ILoadInfoService {private string version; public string Version {set {version = value ;}} private string url; public string Url {set {url = value ;}} private string directory; public string Directory {set {directory = value;} private string updateLog; public string UpdateLog {set {updateLog = value ;}# region ILoadInfoService member public string GetVers Ion () {return version;} public string GetUrl () {return url + directory;} public string [] GetZips () {string folder = HttpRuntime. appDomainAppPath + directory; string [] zips = System. IO. directory. getFileSystemEntries (folder); for (int I = 0; I <zips. length; I ++) {string fileName = Path. getFileName (zips [I]); zips [I] = fileName;} return zips;} public string GetUpdateLog () {StringBuilder Sb = new StringBuilder (); string path = HttpRuntime. appDomainAppPath + directory + updateLog; if (File. exists (path) {StreamReader sr = new StreamReader (path, Encoding. default); string s; while (s = sr. readLine ())! = Null) {// read the previous row. Then, let's see how you handle it. The following are assumptions. Sb. appendLine (s);} sr. close ();} return sb. toString ();} public string [] GetUpdateInfos () {string [] strArray = new string [] {this. getVersion (), this. getUrl (), string. join (",", this. getZips (), this. getUpdateLog ()}; return strArray;} # endregion}

 

UpdateWeb

Configs/AutoUpdateWebService. xml is mainly used for injection by spring.net to implement webservice. After the website is deployed, you can access webservice through the following url: http: // ip/SXSUpdateWebService. asmx. The following is a rough description.

<? Xml version = "1.0" encoding = "UTF-8"?> <Objects xmlns = "http://www.springframework.net" xmlns: db = "http://www.springframework.net/database"> <object id = "SXSUpdateWebServiceBLL" type = "BJCreation. autoUpdate. BLLImpl. loadInfoServiceImpl, BJCreation. autoUpdate. BLLImpl "> <property name =" Version "value =" 20132101 "/> <! -- The version number --> <property name = "Url" value = "$ {local. url}"/> <! -- The url is http: // ip --> <property name = "Directory" value = "UpdateFile/test/"/> <! -- This is the file to be updated from the directory on the server --> <property name = "UpdateLog" value = "$ {local. log}"/> <! -- This is the updated log --> </object> <object id = "SXSUpdateWebService" type = "Spring. web. services. webServiceExporter, Spring. web "> <property name =" TargetName "value =" SXSUpdateWebServiceBLL "/> <property name =" Namespace "value =" http://www.creation.com "/> <property name =" Description "value = "Test webservice"/> <property name = "TypeAttributes"> <list> <object type = "System. web. script. services. scriptServiceAttribute, System. web. extensions "/> </list> </property> </object> </objects>

The source code of the entire article will be included in the second article.

Related Article

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.