.NET Remoting. Amit Gupta, VI TE, SISL 2007-Jan. Topics…. What is Remoting Key Elements Remoting Architecture Configuration of Remote Applications Advantage’s and Disadvantage's Web Services Vs Remoting. Remoting.
Amit Gupta, VI TE, SISL 2007-Jan
Remoting is a technology that allows programs and software components to interact across application domains, processes, and machine boundaries. This enables your applications to take advantage of remote resources in a networked environment.
A remote object is an object running on the server. The client doesn’t call methods on this object directly, but uses a proxy instead. With .NET it’s easy to distinguish remote object from local objects: The client can call methods of the remote objects via a proxy.
A channel is used for communication between the client and the server. There are client and server parts of the channel. .NET framework 1.1 offers two channel types that communicate via TCP or HTTP.
Messages are sent into the channel. Messages are created for communication between the client and the server. The messages hold the information about the remote object, the method name called , and all of the arguments.
The formatter defines how messages are transferred into the channel.
SOAP: can be used to communicate with web services that are not based on .NET FW.
Binary: are much fasters and can be used efficiently in an intranet environment
A formatter provider is used to associate a formatter with a channel. By creating a channel , you can specify what formatter provider to use, and this in turn defines the formatter that is used to transfer the data into the channel.
The client calls methods on a proxy instead of the remote object.
Two types of proxies: Transparent Proxies and the real proxies.
Message Sink or Sink:
A message sink , or sink for short , is an Interceptor object. Interceptors are used on both the client and the server. A sink is associated with the channel. The real proxies uses the message sink to pass the message into channel. And depending on where it is used , it is known as envoy sink, a server context sink , an object sink and so on…….
TcpServerChannel channel= new TcpServerChannel (8086)
Code to create a TcpServerChannel on the server side.
Formatters are associated with channels through formatter sink objects and formatter sink provider.
Both the formatters contains the same information, but the Soap format is human readable and typically much larger than the binary format.
In general , the binary formatter will output much smaller packet than will the SOAP formater.
TcpClientChannel channel= new TcpClientChannel();
channelServices.RegisterChannel( channel );
Hello obj = (Hello) Activator.GetObject ( typeof (Hello ),
The first argument specifies the type of the remote object.
The second argument, “Hi”, is the uniform resource identifier of the remote object that the client uses to access the remote object.
The last argument is the mode of the remote object.
The mode can be a value of the WellKnownObjectMode enumeration: SingleCall or Singleton
Instead of writing the channel and the object configuration in the source code, we can use configuration files. This way channel can be reconfigured, additional channels can be added and so on, without chaning the source code. For .NET remoting, there are some xml XML elements and attributes to configure the channel and remote objects.<configuration><system.runtime.remoting><application name="Hello"><client displayName="Hello Clients for well known objects"><wellknown type="Remoting.Hello, ClassLibrary1" url="tcp://localhost:8086/Hello/Hi"/></client><channels><channel ref="tcp" displayName="Tcp Channel(HelloClient)"/> </channels></application></system.runtime.remoting></configuration>
on the server side, this is the name of the server and on the client side it’s the name of the client application.
<wellknown type=“Wrox.ProCSharp.remoting.hello, RemoteHello”
The programming model is slightly more difficult than the ASP.NET Web services programming model, and Visual Studio .NET support for remoting is not as comprehensive as for ASP.NET Web Services.
Web Services OR RemotingAnd When????