. Net romoting learning Summary (1) -- full access to the activation mode of remoting Technology

Source: Internet
Author: User

This article is reposted from sharping's nonsense blog

Http://www.sharping.net/PermaLink,guid,8e8b1d77-4dce-4e46-8a40-5a873db4e963.aspx

I learned. net remoting technology has been around for some time and is well aware of the wide and profound nature of remoting. I would like to summarize my current understanding of remoting so that I can go to the more advanced remoting technology segment, in this article, I will only explain some of the problems I have encountered. I am very familiar with my technical accomplishments. If not, please advise me.

OK. First, let's take a look at Microsoft's Distributed Solution-remoting technology. Remoting has been fully described on the Internet. Here we will only reference this article.

What is remoting? In short, we can regard it as a distributed processing method. From the perspective of Microsoft products, it can be said that remoting is an upgrade of DCOM, which improves many functions and is well integrated into the. NET platform. Microsoft. NET remoting provides a framework that allows an object to interact with another object through an application domain. This is exactly why remoting is used. Why? In Windows, applications are separated into separate processes. This process forms a boundary around the application code and data. If the inter-process communication (RPC) mechanism is not used, the Code executed in one process cannot access another process. This is an operating system's protection mechanism for applications. However, in some cases, We need to cross the application domain and communicate with another application domain, that is, cross the border.

I would like to add some personal understandings in. net Framework has changed the traditional process-based application boundary approach, but uses the application domain as the application boundary, the problem about the application domain is beyond the scope of this article. For more information, see msdn. When I have time to write it, this is also my learning. net. Remoting mainly solves the problem of cross-border communication. The objects outside the application are called as remote objects. What the remoting client obtains is only a reference of the remote object, not the remote object itself. operations on the remote object are performed on the server. Note! The key lies in this point. If you understand the key to distributed architecture, you should understand that remoting is a feasible solution for processing distributed data. Everyone knows the key difference between distributed and traditional C/S models. By the way, the operations in the traditional C/S mode are completed on the client, while the distributed processing is completed on the server. The problem seems to be getting far away and getting stuck, continue with our theme.

Remoting communication involves three steps: 1, registration channel (server) 2, registration remote object (server) 3, and activation of remote object (client). Of course, the client also has the registration channel step, however, it is not necessary. In my program design, we found that the client can obtain remote objects even if it does not register a channel. You only need to specify the socket on the server where the remote object is located and it will be OK.

The channel types include TCP and HTTP. The registration channel is very simple and will not be mentioned here. There are many articles on Google that will be explained. Activation modes include client activation and server activation. a deep understanding of several activation modes is only the most important for remoting learners. The following describes two activation modes:

1. (1) server activation is also called the wellknow method. Many of them are translated as well-known objects. Why is it called the activation mode of well-known objects? The reason is that the server application will publish this type in a well-known Uniform Resource Identifier (URI) before activating the object instance. The server process then configures a wellknown object for this type and publishes the object based on the specified port or address .. Net remoting divides server activation into Singleton mode and singlecall mode.

Singleton mode: stateful mode. If it is set to singleton activation mode, remoting creates the same object instance for all clients. When an object is active, the singleton instance processes all subsequent client access requests, regardless of whether they are the same client or other clients. The Singleton instance will remain in the status of the method call. For example, if a remote object has an accumulation method (I = 0; ++ I), it is called by multiple clients (for example, two. If it is set to singleton mode, the first customer gets the value 1, and the second customer gets the value 2 because they get the same object instance. If you are familiar with ASP. NET status management, we can regard it as an application status.

Singlecall mode: singlecall is a stateless mode. Once set to singlecall mode, remoting creates a remote object instance for each client when the client calls the remote object method. GC automatically manages the destruction of the object instance. In the same example, the two clients accessing the remote object obtain 1. We can still consider ASP. NET as a session state.

(2) activate the client. Unlike the wellknown mode, remoting assigns a URI for each client activation type when activating each object instance. Once a client request is obtained in the client activation mode, an instance reference is created for each client. The singlecall mode differs from the client activation mode: first, the creation time of the object instance is different. The client activation method is instantiated once the customer sends a call request, while the singlecall method is created when the object method is called. Second, the objects activated in singlecall mode are stateless, and the object lifecycle is managed by GC, while the objects activated on the client are stateful, and their lifecycles can be customized. Third, the two activation modes have different implementation methods on the server side and the client side. Especially on the client, the singlecall mode is activated by GetObject (), which calls the default constructor of the object. The client activation mode is activated through createinstance (), which can pass parameters, so you can call a custom constructor to create an instance.

Outside:

If I remember correctly, Li Shangyin said in a love poem: chang'e should regret stealing the spirit medicine, bihai Qingtian night heart. I really regret that I didn't have enough time to study when I came in from the university. Now I find that I don't have enough time. I am sorry, I don't have to work hard, and I think it's just like the words in the movie "tong mengqiyuan: "It seems that everyone has a lot of time, but I don't think I have enough time ".

OK! Time is limited. I will write it here today. I will take the test and read the book this week. I will continue to write the following content later.
 

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.