"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