ASP.NET FAQ (PART III) - Remoting
What is an application domain?
In classic ASP there is no concept like Application domain .Application domain is a new security boundary concept in Dot Net. Process can be divided into multiple application domains. We know process level isolation that means if one process crash that will not affect other process. Every application runs under a separate application domain in Dot Net. So if there is any problem in one application domain that will not affect other application domains in the same process.
What is Dot NET Remoting?
Remoting is the way of communication between different application domains or processes using different transportation channels (TCPChannel, HttpChannel etc.) and different serialization format (binary formatter and soap formatter).It works in homogeneous environment. Client calls the proxy of remote object in order to communicate and the value (if any) is returned from remote object through proxy to the client.
What namespace is responsible for remoting in Dot Net?
The System.Runtime.Remoting namespace provides classes and interfaces t to create and configure distributed applications.
What are the main classes responsible for Dot Net remoting?
According to MSDN, the important classes of the System.Runtime.Remoting namespace are the RemotingConfiguration class, the RemotingServices class, and the ObjRef class. The RemotingConfiguration class contains static methods for interfacing with configuration settings. The RemotingServices class provides a number of methods to help in using and publishing remoted objects. The ObjRef class holds all the relevant information required to activate and communicate with a remote object.
Explain the two different types of remote object creation mode in Dot NET.
There are basically two types of remote object creation mode: SAO and CAO .
SAO or Server activated objects have two modes:
Here server creates the remote object instance for each client separately and client controls the lifetime of the server object.
Define LeaseTime, SponsorshipTime, RenewOnCallTime, LeaseManagePollTime.
A “LeaseTime” of five minutes is assigned default to every server side object and default of two minutes is assigned for every method call from clients which is known as “RenewalOnCallime”.So we can define life time of remoting object = LeaseTime + (Number of method calls) X (RenewalTime). .NET Remoting Framework consults a sponsor when a lease expires and provides the sponsor an opportunity to renew the lease. If lease is not renewed the object is marked for garbage collection. SponsorShipTimeOut represents the time by which a call to a sponsor is timed out. “LeaseManagerPollTime” represents the time by which the sponsor has to return a leasetime extension.
What are the consideration in deciding to use Dot NET Remoting or ASP.NET Web Services?
Remoting is a more efficient communication exchange when we have control both ends of the application involved in the communication process that means remoting is ideal in homogeneous environment. Web Services are best in form and language independent.
What’s a proxy of the server object in Dot NET Remoting?
It is a copy of the server object that resides on the client side and behaves as if it was the server. It handles the communication between real server object and the client object.
What are remotable objects in Dot NET Remoting?
Remotable objects are the objects that can be marshaled across the application domains. We can marshal by value, where a deep copy of the object is created and then passed to the receiver. We can also marshal by reference, where just a reference to an existing object is passed.
What are channels in Dot NET Remoting?
Remote objects are accessed through channels. Channels physically transport message to and from remote object. There are two types of channels in .net remoting .TCP channel uses binary formatter for making stream and it is useful when client and server both are using same OS. HTTP channel uses SOAP formatter for making stream in the form of XML representation,so that it can travel between different OS.A channel must exist before an object can be transferred to another application domain or process.
What is a formatter?
A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end. There is two types of formatter: Binary formatter and SOAP formatter.
Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters, what is the trade-offs?
Binary over TCP is the most efficient , SOAP over HTTP is the most interoperable.
What is marshalling? Explain types of marshalling.
Marshalling means how a remote object is exposing to client. There is two type of marshalling:
Marshaled by value (MBV): The server creates an exact copy when a client makes a call to an object using MBV, and sends that copy to the client. The client can then use the object without any additional call to server.
Marshaled by reference (MBR): When a client makes a call to an object using MBR, the .NET framework creates a proxy in the client’s process and the client uses that proxy to access the original object on the server as if the object is with the client.
Explain the purpose of ObjRef object in remoting.
Using ObjRef an object can be represent in serialized form which extends MarshalByRefObject (MBR). ObjRef is used to transfer an object reference across athe process or appdomain boundary. Creating ObjRef for an object is nothing but marshaling.
Explain the differences between Web Service and Remoting:
Re: ASP.NET FAQ (PART III) - Remoting
Nomination this Article for Article of the month - May 2009
|All times are GMT +5.5. The time now is 22:50.|