All about Conceptual Analysis on .NET Remoting

In 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 object’s 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.

Workflow of .NET Remoting has the following steps:

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.

• Real Proxy: When Transparent Proxy receives the request for the remote method, it triggers the real proxy.

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:

7. Refer Below:
• SOAP Formatter formats data as XML messages
• Binary Formatter formats data as binary messages

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.
• TCP Channel: Uses TCP Protocol to transport the message. TCPChannel processes the message formatted using Binary Formatter. This channel is accessed in code as Tcp.

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:


9. Channel transfers the message from client’s application domain to server’s application domain.

10. Method call received by server’s application domain is formatted by the suitable formatter.

11. Method call is then sent to the actual server object. Server object will be represented as:
public class SampleServerObject : MarshalByRefObject { }

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.

| All about Conceptual Analysis on .NET Remoting | Building desktop applications in .Net | Building Distributed Applications Efficiently Using .Net Remoting | C# (C Sharp) Unified Type System: Reference Types | C# (C Sharp) Unified Type System: Value Types | Data access in .Net | Delegates Vs Interfaces in C# (C Sharp) | How is Integration between Java and .NET Achieved | How is Versioning Achieved in C# (C Sharp) | Implementing Authorization and authentication in | Implementing design patterns in .Net | List of Query Keywords in C# (C Sharp) |


“Amazon and the Amazon logo are trademarks of, Inc. or its affiliates.”

| Privacy Policy for | Disclosure | Contact |

Copyright - © 2004 - 2024 - All Rights Reserved.