Thursday, February 4, 2010

Describe the .Net Remoting Architecture

.Net Remoing allows communication between server and client objects. To facilitate this, when new instance of remote object is created in the client application, the client receives reference (called proxy) to the server object. This proxy object contains references to all the methods and properties of the server object. When the client object calls any method (the call actually on proxy object), which resolves the references and invokes server object, receives the result and pass on to the client application.

What are the remotable and non-remotable objects in .Net Remoting.

The remotable objects are the objects which can be distributed accross domains, can be used with domain. The non-remotable objects are the objects which can't be distributed accross domains. In distributed system, if an object is very big, we can make it non-remotable object.

Describe the type of remotable objects in .Net Remoting.

Marshal-by-value-objects - When client calls a method on marshal-by-value-object, the remoting system creates a copy of this object and passes the copy to the client application domain. The copy hence received can handle any method call in client domain. Using Marshal-by-value-object reduces resource consuming trip across network. 
Marshal-by-reference-object 
- When client calls a method on Marshal by reference object, the remoting system create proxy object in the caller application that contains the reference of all method and properties of the object.

What are the types of activation modes in .Net remoting?

Server Activation Mode: In this mode, objects are created on the server when we call a method in the server class and not when we create instance using new. In this type of scenario, the client is always connected with server but the services are activated only when we call the method of the server class. We can create server activated object as a Singleton or SingleCall object. If we create server object as singleton, a single instance will manage all the clients. If we create server object as singlecall, the remoting system creates object each time a client method invokes a remote object.
Client Activation Mode: This object gets created when we create instance using new keyword. In this mode, client application domain defines the lifetimes of client activated objects. The client domain defines the lifetimes of client-activated objects. They use lifetime leases to determine the duration of their existence and after the lifetime expires, the object is marked for GC.

0 Comments: