What is asynchronous programming?
Answer - .Net Remoting supports asynchronous programming. In this model, a call is made to a class method while the calling program continues to execute. This increase application speed as the application continues to execute without waiting for the called methods to finish execution.
When do we use delegates in your remoting applications?
Answer - You use delegates to implement callback functions, event programming, and asynchronous programming in your remoting applications. Events use delegates to enable callback functions to the client in remoting applications.
What are the ways to renew lifetime leases of objects?
Answer - A client can renew the lifetime lease of an object by calling the ILease.Renew method.
What are the types of remotable objects?
Answer - The two types of remotable objects are
Marshal-by-value objects - These objects are copied and passed by value out of the application domain. 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 objects - The clients that use these objects need a proxy to access the object remotely. 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 Security features in .Net Remoting.
Answer - .Net Remoting is integral part of .Net Framework, so it has access to all security features of Framework. If remoting objects are hosted using IIS, it leverages the entire authentication and authorization features that are available to Web based protocols. If hosted other than HTTP protocols over IIS, then you have the opportunity to create your own security infrastructure.
What are the information required to configure remote objects?
Answer - Following information to be provide to configure remote object.
Activation type for the remote object
Channels
URL of the remote object
Type metadata of the remote object
Explain Serialization Formatters in .NET Remoting.
Answer - In .Net Remoting, the objects are shared over distributed network. The objects are transmitted in serialized form. The objects are first serialized into message data before it is sent with the wire. On the other end of the wire, this serialized data is read and desterilized back to the actual object. This process of converting objects into message data is done by serialization formatters. .Net Remoting supports two formatters.
SOAP Formatter
Binary Formatter
SOAP Formatter converts objects into XML string whereas Binary Formatter converts an object's state into a binary stream. The binary serialization formatter is slightly faster.
What are the requirements to enable remote components to interact each other?
Answer - To enable communication between objects across remoting boundaries, you need to have
A server object to expose service
A client that calls server object to consume service
A message transmission protocol
Steps to publish an object outside the service domain.
Answer - To publish a service outside the service domain, you need to:
Identify the application domain that will host the service.
Identify the activation model: server activation or client activation.
Identify and create a channel and a port.
Identify how the client application obtains the metadata information about the service.
Define Client Activated Objects (CAO).
Answer - Client-activated objects are objects whose lifetimes are controlled by the client, i.e. calling application domain. This mode works in similar fashion to the model where object is local to the client and referenced object's lifetime is controlled by the calling object. When instance of server object is created, object reference is obtained in the form of proxy.
In COM model, clients hold an object in memory by holding a reference to it. The object is released from the memory when the entire client releases the reference. But in .Net Remoting, client-activated objects use lifetime leases to determine how long they should continue to exist. When a client creates a remote object, it can specify a default length of time that the object should exist. If the remote object reaches its default lifetime limit, it contacts the client to ask whether it should continue to exist, and if so, for how much longer. If the client is not currently available, a default time is also specified for how long the server object should wait while trying to contact the client before marking itself for garbage collection. The client might even request an indefinite default lifetime. Client-activated instances serve only the client and the reference that was responsible for their creation.
To create an instance of a client-activated type, clients either configure their application programmatically or using a configuration file and call new, or they pass the remote object's configuration in a call to Activator.CreateInstance.
Explain Marshalling and its types in .Net Remoting.
Answer - Objects can't be transmitted as such over communication channel. The objects are packed into message buffer before transmitted. This process is called marshalling. There are two different ways to Marshal objects
Marshal by Value: Server creates copy of the remoting object's state and passes it to the client. You need to implement your classes to have marshal by value features either by implementing ISerializable interface or using attribute. Here you need to copy whole object to the client which means with large size object, the communication overhead is significant.
Marshal by Reference: In this type proxy is created by the reference of the server objects. Class must extend the System.MarshalByRefObject to implement marshal by reference. Here, client keeps server object reference which means round trip to server with each method call.
Summary of .Net Remoting
.Net enables interaction between applications over distributed network.
To develop a Remoting application, you need to create client and server objects. You need to activate the objects and use reference of the server objects in client to communicate.
Channels allow application to send and receive messages using protocal like TCP or HTTP.
You can use delegates in Remoting application to implement event based programming and asynchronous programming.
Asynchronous programming in Remoting application helps to calls remote methods while client continues to execute other local method.
To host remote object, server needs some information about the objects.
The information can be provided programmatically in the code or can be loaded from configuration section of application configuration file or machine.config file.
Being part of .Net Framework, .Net Remoting can implement role based security. Moreover, it can leverage all security features of ASP.NET, if it hosted in ASP.NET.
What is .Net Remoting?
.Net Remoting enables communication between applications across separate domains or networks. .Net objects are exposed to remote processes to have interprocess communication. With remoting, we can use TCP or HTTP communications protocols on any port. We can use text or binary formatting. .Net Remoting supports server activated (single call and singleton) as well as client activated objects.
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.
No comments:
Post a Comment