Internet-based deployment in. net

Source: Internet
Author: User
To use this deployment, the client must have. NET Framework and an Internet connection. In addition, the system used for deployment must be a web server installed with. NET and IIS.

The deployed application is placed in a directory on the server and can be located using a URL. Then, the application can be started in either of the following ways:
On the web page, click the link pointing to the startup EXE of the application on the server.
Use a small "launch program" application to point to the master application on the server. This startup program is actually a local shortcut to the application.
Both download the application from the Internet and execute it locally.

The procedure is as follows:
1: Build a form application in strict accordance with the method for developing a Windows form application
2. After the development is complete, change the compilation options for all Windows Forms projects in the application to create a DLL file. Suppose we have created an appdll1.dll.
3. Copy all the DLL files that contain the application to a Web Folder. This includes the DLL files used by the application to start Windows Forms, and the components or other DLL required by the application.
4: Create a Startup Program. The reflection function is used to start a new application. Put a button on the form. The Code is as follows:
Using system. reflection;
Try
{
String Surl = "htpp: // MyWebServer/MyApp/appdll1.dll";
Assembly objass = assembly. loadfrom (Surl); // obtain the Assembly
Type formtype = objass. GetType ("myprojectname. startform"); // obtain the type in the Assembly List
Object OBJ = activator. createinstance (formtype); // create an object dynamically based on the Type
Form F = (form) OBJ;
F. Show ();
}
Catch (exception ex)
{
MessageBox. Show (ex. Message );
}

When we start the application, let's take a look at what happened in the background:
At startup, it requests to load classes from the non-existing assembly on the client. At this time, the Assembly is automatically obtained from the deployment web server and put on the local client. it resides in the client application download cache. once the Assembly is placed in the application download cache on the client, classes can be loaded and run from the Assembly. this includes all required forms (the form is also a class ). or all other objects that belong to the application. we can check which assembly has been downloaded:
> Gacutil/LDL this command line allows you to view the list of Assembly downloads on the client.

An application is controlled by a form loaded from the Web server. It can perform operations and load other forms as needed. if another form is loaded from the same assembly, those forms are automatically loaded without any special logic.
When. net in the download cache to find the Assembly, if found, it will check the assembly version. check the current version of the same assembly on the Web server (if the Internet connection is available ). if a new version of the Assembly exists on the Web server, download and cache the new version and replace the original version for use. this makes the automatic deployment run automatically.
If the application is in offline mode (Internet unavailable), the current version test will be skipped and the original version will be used in the download cache.

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.