ASP.NET FAQ (PART III) - Remoting

Discussion in 'ASP.NET' started by sanjitsil, May 5, 2009.

  1. sanjitsil

    sanjitsil New Member

    Joined:
    Dec 9, 2008
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Lead Software Engineer in an MNC
    Location:
    Hyderabad
    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:
    1. Singlecall – Here the server object is instantiated for responding to just one single call object.
    2. Singleton – Here the server object is instantiated for responding number of clients.
    CAO or Client activated objects are stateful unlike SAO

    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:

    Web Services:
    • Can be used by Non-.NET Clients
    • Supports http
    • Strictly XML Based

    Remoting:
    • Client and Server both should have .NET framework to be installed.
    • Supports http and tcp
    • Supports XML and Binary Serialization
    • Better Performance
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice