All about Conceptual Analysis on .NET RemotingIn general, objects in your ASP.NET Application will access methods belonging to objects of the same package or different package but belonging to the same application domain. What if your object has to access an objects method belonging to a different application domain?
In that
case, method which your object tries to access is the remote method and
this method can be accessed using .NET Remoting. This article will help
you in conceptually understanding the workflow of .NET Remoting. 1. Client object will create an instance of server object. Here client object is your object (object of your class) and the server object is the remote object that you are trying to access. 2. Call the remote method using instance of server object. 3. Since the server object is a remote object, it cannot be directly accessed when it is called from the client object. Hence the method call will actually invoke a proxy. This proxy will then point to the server object. Proxy objects are of two types: Transparent
Proxy: Default proxy invoked by .NET Remoting Framework when the client
object calls remote object method. 4. Client object calls transparent proxy which in turn invokes the real proxy. 5. Real proxy sends the method call along with the parameters (if any) to the Formatter. 6. Formatter
formats the data sent along with the method call. The data has to be understandable
by the network to transfer it. There are two types of Formatters: Soap.SoapFormatter and Binary.BinaryFormatter belong to the namespace: System.Runtime.Serialization.Formatters. 8. Formatted message is then transported from your application domain to the application domain containing server object. This is done using Channels. Channels are of two types: HTTP
Channel: Uses SOAP Protocol to transport message. HTTPChannel works along
with SOAP Formatter. HTTP Channel is accessed in code as Http. Both the channels belong to the namespace: System.Runtime.Remoting.Channels. A channel will transfer method calls or messages only when it is registered. You can register a channel using the following line of code: ChannelServices.RegisterChannel(); 9. Channel transfers the message from clients application domain to servers application domain. 10. Method call received by servers application domain is formatted by the suitable formatter.
Your method call can contain the server object as a parameter. In that case, is the server object passed by value or passed by reference? If the server object implements MarshalByRefObject as shown above then the object is passed by reference. If not, then the object should implement ISerializable interface as shown below: public class SampleServerObject : ISerializable { } In this case, the object is passed by value. 12. Server object responds to the method call by executing the corresponding method called by the client object. 13. After execution of the method, server object sends the response to the client object through the same workflow.
|