. Net Remoting [1],. netremoting

Source: Internet
Author: User

. Net Remoting [1],. netremoting

[. NetRemoting] 2015.09.16
[Distributed application]
Applications are distributed on different computers and a task is completed through the network.
C/S architecture [mode]
[Interoperability, Interoperability], also known as [Interoperability]
It refers to the ability of different computer systems, networks, operating systems and applications to work together and share information.

[. Net network programming technology]
WCF, Web Service, Remoting, Socket

[Application Domain, AppDomian, Application Domain]
1. [reason]
[1]. Net Assembly needs to run in the managed environment
[2] The operating system does not understand the managed code
[3] an intermediary is required to provide a hosted environment for the Assembly and run in an unmanaged operating system process ==> AppDomian;
[4] All. Net Assembly runs in AppDomain
2.
[The application domain is run to access the services provided by. Net CLR for the Assembly loaded for it]
[Runtime service provided by. Net]
Hosting heap, GC, JIT compiler, assembly loader, etc.

3.
[1] AppDomian can be compared to a lightweight process,
[2] one thread can have multiple AppDomian
[3] [Default Application domain] + [other application domains]
[4] application domains provide isolation similar to processes

4. advantages of creating AppDomian
[Process Creation of an AppDomian is less costly than creating a process in the operating system]

5. Basic operations in the application domain
[1] Get the AppDomian of the current running code/assembly
AppDomian. CurrentDomain;
Thread. GetDomain ();
[2] Get the application domain name
FriendlyName
[3] Create a new application domain
AppDomian. CreareDomain ("AppDomianName ");
[4] create an object in the application domain
[A] use the CreateInstanceAndUnWrap () method;
[B] create an object using the CreateInstance () method

[5] determine whether it is the default AppDomian
Isdefaappappdomain ();


[Default program domain]
[1] A thread is created when it is created.
[2] It cannot be uninstalled, And it is born and destroyed together with the process in which it is located.

[Create an object in the default program domain]

[Create an object in the new application domain]
The object is passed to the local AppDomian from another AppDomian.
Serialize the passed object

[Thinking]
How to use the application domain to dynamically load an assembly

[Proxy]
[1] What is the difference between creating an object in an application domain and using constructors to create an object?
[Constructor]
Directly create an object in the heap, which is directly referenced by the variable name.
[Create an object in the application domain]
[1] create an object in the application domain
[2] serialize the object and then mail it to [serialize aling] to the local/client application domain ==> [Remote Object]
[3] re-create an object in the client application domain, restore the object status, ==> create an object Proxy [Proxy], [Proxy object]
[4] The client accesses a remote object through a proxy object

[Proxy] provides the same interface as the remote object.
The client creates a proxy Based on the Type metadata of the remote object. Therefore, the client must contain the type metadata of the remote object.
[Metadata]
Type interface, including name and signature, excluding implementation code

[Proxy object] The object created in newAppDomain
Remote Object: the object created in the client application domain.

[Mail, Marshal] => 2 medium mode, pass value, pass reference
[Pass Value mails, Marshal By Value] transmits the object to the client
[Pass reference and mail, Marshal By reference] keeps the object in the remote AppDomian, creates a proxy, and accesses the remote object through the proxy.
[Method of sending and Referencing] [There are three methods]
[1] Client activation [Client activated] ==> Client activation Object, CAO, Client activated Object
[2] The server activates Singleton [Service activated Singleton]
[3] The server activates SingleCall [Service activated SingleCall]

[Transfer reference mails] => MBR object
[Externalbyrefobject object]
The object to be sent must inherit the MBR class.
[When an object inherits from MBR, it indicates that the object can never leave its application domain]

[Advantages of sending by referencing and sending by value]
When an object is large, the efficiency of sending value messages is low. To send value messages, you need to serialize the object and mail the entire object to the client, increasing the network burden...

[Remoting]
Access across application domains belongs to Remoting.
[Whether AppDomian is in the same process, AppDomian in different processes on the same host, or a process on different computers]
[Client]
End of the request
[Server]
Provide one end of the type

[A typical Remoting program]
[1] [Service assembly, type of service provision]
==> These types are generally inherited from MBR. [the advantage of passing references to mails]
[2] [server application] ==> [Host application domain]
==> Provide the environment for running service Assembly [IIS, Windows Service, console program, winform program, etc]
[3] [client application domain]
==> Application domains that send requests to the Host application domain

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.