Graphic DOTNET framework 10: WCF (remoting, WebService)

Source: Internet
Author: User

(Disclaimer: this series is intended for you only. the Net Framework is not an explanation of syntax and class usage. Therefore, you can only briefly describe the mentioned classes. If you have any questions, go to msdn to check)

 

WCF is an integration of technologies such as WebService,. Net remoting, Enterprise Service, WSE, and MSMQ. So what is the relationship between remoting and WebService?

Since he is integrating remoting, WebService, and other technologies, let's take a look at the remoting and WebService architecture. The remoting architecture is similar to the remoting architecture, there are only a few things missing, and we will explain it later. Let's take a look at it first:

 

Let's first explain remoting:

 

1. Remote processing object (MBR): Because the objects passed by remoting are referenced, the remote object class passed must inherit the marshalbyrefobject class. Externalbyrefobject is the one that uses proxy to exchange messages across applications.ProgramThe base class of the object for communication at the domain boundary.

 

2. wko and Cao: before accessing a remote object instance, you must create and initialize it through a process named activation. This client creates a remote object through a channel, which is called object activation. In remoting, the activation of remote objects is divided into two categories: wko and Cao:

 

(1) server activation (wko) 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. Then the server process configures a wellknown object for this type and publishes the object based on the specified port or address. remote object constructor with parameters cannot be used, that is, the remote object must have no parameter constructor .. Net remoting divides server activation into Singleton mode and singlecall mode.

Singleton mode: that is, the object has only one unique one, that is, Singleton in gof23 (single-piece mode). singlecall mode: Creates a remote object instance for each client.

 

(2) Client activation (CAO ). Unlike the wellknown mode, remoting assigns a URI for each client activation type when activating each object instance. The difference between Cao and wko is that CaO can use remote object constructors with parameters.

 

3. Scheduler: host to EXE, or service (Windows, IIS ).

 

4. Formatting program and channel: After formatting the remote processing object, it is transmitted to the client through a fixed channel.

There are two channels for remoting: TCP and HTTP. The TCP channel provides a socket-based transmission tool that uses the TCP protocol to transmit serialized message streams across the remoting boundary. tcpchannel uses binary format to serialize message objects, so it has higher transmission performance. The httpchannel type serializes message objects in the soap format, so it has better interoperability, and the formatting program and channel correspond to each other. about the formatting type. net has three types: XML, SOAP, and binary. see:

 

Client proxy: As mentioned above, remoting transmits formatted remote processing objects by reference, and then generates a proxy for this object on the client to complete business operations.

 

 

Okay, we know how remoting works. Let's take a look at the way WebService works. We have mentioned that remoting and WebService have the same architecture but different architectures, the difference lies in the remote processing objects and activation methods on the server side, as well as formatting and channel, as well as client proxy.

 

 

1. Remote processing object (mbv): WebService is a value-based object that inherits from marshalbyvaluecomponent. This class is sent by value (passing a copy of The serialized object ).(Remoting is passed by reference)

 

2. Activation Method: wko and WebService are activated by wko and in singlecall mode. (remoting is wko + CAO)

 

3. Scheduler: host to IIS. (remoting can host to many. NET applications)

 

4. Formatting program and channel: After formatting the remote processing object, it is transmitted to the client through a fixed channel.

There are two main types of WebService channels (in fact, they cannot be two types of channels, but two formatting methods): soap and HTTP. The soap type serializes the message object in the soap format, while HTTP uses XML for formatting (remoting is TCP and HTTP)

 

5. client proxy: In WebService, this proxy is a copy of the remote object. (remoting is a reference of the remote object)

 

Although they know these differences, there are more important WebServices that do not require Client installation. net, but the performance is not as good as remoting; remoting needs to be installed. net, but the performance is high. the emergence of WCF is to integrate and encapsulate them (of course, not only WebService and remoting), so that your remoting can be changed to WebService, but WebService can be changed to remoting. You only need simple configuration, the implementation principle is the first figure above. developedArticleThere are many good gardens, so I won't go into details here.

 

 

 

 

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.