Remoting - Interview Questions
What is .NET Remoting?
.NET Remoting allows objects to interact with one another across application domains.
What are the 2 message encoding formats supported by .NET Remoting and when do you choose one over the other?
Message Encoding Formats:
1. Binary encoding.
2. XML encoding.
Applications can use binary encoding where performance is critical, or XML encoding where interoperability with other remoting frameworks is essential.
What are the two types of .NET remote objects?
1. Client-activated objects - Client-activated objects are under the control of a lease-based lifetime manager that ensures that the object is garbage collected when its lease expires.
2. Server-activated objects - In the case of server-activated objects, developers have a choice of selecting either a "single call" or "singleton" model. The lifetime of singletons are also controlled by lease-based lifetime.
What is considered as Remote Object?
Any object outside the application domain of the calling appication is considered remote object, even if the objects are executing on the same machine.
Can you treat every object as a remote object?
Objects that cannot be serialized cannot be passed to a different application domain and are therefore nonremotable.
What are the ways in which an object can be serialized?
1. Mark your class with serializable attribute.
2. Make your class implement ISerializable interface.
How can you change an object into a remote object?
Any object can be changed into a remote object by deriving it from MarshalByRefObject.
What happens when a client activates a remote object?
When a client activates a remote object, it receives a proxy to the remote object. All operations on this proxy are appropriately indirected to enable the remoting infrastructure to intercept and forward the calls appropriately.
What are proxy objects and what is the use of these proxy objects?
Proxy objects are created when a client activates a remote object. The proxy object acts as a representative of the remote object and ensures that all calls made on the proxy are forwarded to the correct remote object instance.