Thursday, 28 October 2010

.NET Remoting

.NET Remoting provides a powerful and high performance way of working with remote objects. Architecturally, .NET Remote objects are a perfect fit for accessing resources across the network without the overhead posed by SOAP based WebServices. .NET Remoting is easier to use than Java's RMI, but definately more difficult than creating a WebService.

Application Domains and Proxies
.Net Remoting is the .Net framework's solution for making remote procedure calls. That is, function calls across a process boundary. To facilitate this, the notion of an application domain has been introduced. Application Domains are a logical construction of the CLR. While the classic programming model relyed on the Operating System to provide memory and process space, the CLR must also provide an environment for managed code. The CLR takes a process and creates these Application Domains within which managed code runs. A process can host many of these logical Application Domains each with its own set of loaded assemblies.
appdomain .Net Remoting   Part1 Introduction
While the main application domain is created automatically by the CLR one can be created like this:

using System;
using System.Reflection;

AppDomain domain = AppDomain.CreateDomain("MyDomain");

When a call is made between objects in the same Application Domain only a normal local call is required, however a call across Application Domains requires a remote call. In order to facilitate this a proxy (an instance of the TransparentProxy class) is introduced by the .Net framework at the Client side. On the server a stub is created.
When programming with .Net Remoting a remote call to an object in another application domain whether it is in the same process or on a machine across network is transparent to the application. In general three pieces pieces are required.
A Server – that provides the remote functionality.
A Client – that makes the remote call.
A commom interface that is known to both the server and the client. 
 
 
Here is some link understand how to use .net remoting.

http://www.codeproject.com/KB/IP/Net_Remoting.aspx
http://www.csharphelp.com/2006/12/net-remoting-part1-introduction/
 
Thanks