Demo address: serverautoupdate.rar
Test procedure:
1) install the serverautoupdate. Server Windows Service and modify the Web service address in the configuration file to serverautoupdate. selfupdatewinserive. mgrsite.
2) Open serverautoupdate. selfupdatewinserive. mgrsite and select a service. You can see that an instance has been registered and upload a file (for example, you can update the version number of serverautoupdat. servercore and then update it)
3) after a while, you can click to view the update result to see the results of the update file on the server.
Basic Principles:
1) To enable Windows Services to support such updates, you only need to call selfupdatemodule. Register () at onstart and call selfupdatemodule. unregister () at onstop (). (Of course, serverautoupdate. selfupdatewinserive. dll must be referenced.) When register is used, access the Web service to register the service itself and perform reverse registration when unregister is used.
2) In the serverautoupdate. selfupdatewinserive. mgrsite website, app_data maintains a list of all active Windows Services for update.
3) call a remoting service in selfupdatemodule during the update process. Push the new file in the push mode. The server is very easy to do, save the file locally, and then call process. start to enable a cmd. Run cmd to pause the current Windows Service, update the file, and start the service. (Note that the remoting service can only be one-way due to service restart ).
4) after the service is restarted, The selfupdatemodule. Register () method checks whether there are update folders in the local folder. If yes, the Web Service is called to notify the update result and delete the folder.
5) view the file to view the UPDATE results of all instances.
As a matter of fact, the update principle is to use process. Start to start a bat Update file. Otherwise, it is difficult to update the dependent files ".