【. NetRemoting-3 "2015.09.18

Source: Internet
Author: User

"Basic implementation of the Remoting program"

"One" service assembly
The "1" service object must be required to inherit "Mbr,marshalbyrefobject"

"Two" service-side applications
"1" Registration channel
"Two types of channels"
"A" sends the requested channel, requiring the implementation of the IChannelSender interface
"B" accepts the requested channel and requires the implementation of the IChannelReceiver interface
【. NET provided by the built-in channel "==> are implemented Ichannelsender,ichannelreceiver,ichannel
"HttpChannel"
==> can be implemented across firewalls
==> "message" formatted with "SOAP"
"TcpChannel"
==> cannot cross firewalls
==> "message" formatted with "binary"
"Icpchannel"
==> cannot cross a computer and can only be accessed across threads within the same computer.
==> bottom based on "named pipe, Named pipe"

"Code Implementation"
"A" instantiates A channel object
==> two methods of constructing channel object
"B" register channel with ChannelServices.RegisterChannel (Channelobj,bool)

The "2" registration type ==> tells the client which objects in the host application domain are accessible to the client
"Three ways to activate a service object"
"1" Client activation
"2" service-side activation Singleton "Server activated Singleton"
"3" service-side activation SingleCall "Server activated SingleCall"

"Code Implementation"
==> using the Remotingconfiguration.registeractivatedservicetype (type) "Client Activation" method
==> using Remotingconfiguration.registerwellknowservicetype (Type, "Objuri", Activattype) "server-side activation mode"

"3" Object position
How does the client know the object's location? ==>url
"Remotingconfiguration.applicationname" Property
"URL form"
"Service Activated"
==> Protocal://hsotadress:port/applicationname/objecturl
"Client Activated Object"
==> Protocal://hsotadress:port
==> Protocal://hsotadress:port/applicationname

"Three" client program ==>only one Task
===> Gets the remote object, calling the remote object method.
Steps
"A" registration type ==> inform. NET the object should be registered on the server, not on the local
==> Client type registration with service-side type registration is similar to "using RemotingConfiguration"
==> using the Remotingconfiguration.registeractivatedclienttype (Type,uri) "Client Activation" method
==> using Remotingconfiguration.registerwellknowclienttype (type, "uri") "server-side activation mode"

The "B" new operator creates an object

"2" Other ways to create remote objects
==> "Remotingservices.connect ()" ==> simple, more common, can only call the parameterless constructor, get the object while creating the proxy
==> "Activator.GetObject ()" ==> simple, more common, can only call the parameterless constructor, get the object while creating the proxy
==> "Activator.CreateInstance ()" ==> can invoke the parameter constructor, but only the client activation object is created.

【. NetRemoting-3 "2015.09.18

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.