What is. Net Remoting "Go"

Source: Internet
Author: User
Tags configuration settings soap

The Kiwi encyclopedia defines it as follows:

Net Remoting is a network communication technology in the Microsoft. NET Framework, unlike XML Web Service, which can communicate using protocols other than SOAP, while the methods that operate between the server and client are nearly identical, and the client can You can access objects that are open on the server, without having to consider the use of the contract. This technique is developed with Distributed COM, the biggest difference with DCOM is that DCOM has restricted the use of TCP Port, but. NET Remoting can choose to communicate using TCP or HTTP, and the data can be used in SOAP or binary mode The flow of the network, binary transmission efficiency is not comparable to soap, but soap can get and Web Service to communicate with each other's ability, so. NET Remoting design flexibility.

. NET Remoting Technology is now integrated into the Windows communication Foundation.

Principle

. NET Remoting uses the channel and serialization mechanisms to string the objects between two machines, the channel is the part that handles the network traffic, and the serialization is the processing of objects and streaming data.

    • The Channel supports IPC (inter-trip communication), TCP and HTTP Protocol [1].
    • Serialization supports data streams for binary (binary) or XML (SOAP) communication protocols [2].

When the server is set up to use the channel and the Protocol, the client must follow the servo-side settings, and according to the servo-determined activation model to start, and the program design method and the general call element as simple.

public static void Main () {   remotingconfiguration.configure ("Client.exe.config");//Configure Remoting Configuration.   RemotableType remoteobject = new RemotableType (); Create remoting object.   Console.WriteLine (Remoteobject.sayhello ()); Call Remoting object ' s method.}
Configuration settings

The design concept of. NET Remoting is to simplify the communication of objects on the network, and to make it unnecessary for developers to be too bothered at the bottom of the communication, so many wrappers are made on the network protocol and allow the Configuration File (App. config) is set directly or by the configuration API of the. NET Remoting, so the configuration setting has a high degree of complexity, and the design of a more complex. NET Remoting application is often quite complex in configuration settings.

Here are the example settings for setting the. NET Remoting Client:

<configuration>   <system.runtime.remoting>      <application>         <client>            < WellKnown                type= "RemotableType, RemotableType"               url= "Http://localhost:8989/RemotableType.rem"            />         </client>      </application>   </system.runtime.remoting></configuration>
Activation model

Activation (Activation) refers to the way in which the client initiates the servo-side component, which is supported in. NET Remoting in two ways [3]:

    • Single-call: An instance is generated for each client call.
    • Single-ton: The instance is generated on the first call, and then each call uses the same instance.
Object delivery

In. NET Remoting, whether it is a value or a pass-through, each object must inherit the System.MarshalByRefObject category before it can be transmitted using. NET Remoting.

The following code is the Remoting component on the server side:

Remotabletype.csusing System;public class Remotabletype:marshalbyrefobject//Remoting objects must be inherited from System.MarshalByRefObject category. {Public    string SayHello ()    {        Console.WriteLine ("Remotabletype.sayhello () is called!");        Return "Hello, World";    }}

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.