Thursday, February 4, 2010

.Net Remoting Interview Questions and Answers

Define windows process

Answer - A process is an instance of a running application.
Each process is allocated its own block of available RAM space.
No process can access another process code or data.
If the process crashes, it dies alone without taking the entire OS or a bunch of other applications down. 

Define channels in .NET Remoting

Answer - Channels represent the objects that transfer the other serialized objects from one application domain to another and from one computer to  another, as well as one process to another on the same box.
A channel must exist before an object can be transferred.

What security means available for .NET Remoting in System.Runtime.Remoting?

Answer - None. Security should be taken care of at the application level.
Cryptography and other security techniques can be applied at application or server level.

What is a formatter in .Net Remoting?

Answer - 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.

.NET Remoting and Web services.

Answer - Use remoting for more efficient exchange of information when you control both ends of the application.
Use Web services for open-protocol-based information exchange when you are just a client or a server with  the other end belonging to someone  else.

Name the distributed systems available apart from .Net Remoting.

Answer - Distributed Computing Environment/Remote Procedure Calls (DEC/RPC),
Microsoft Distributed Component Object Model (DCOM),
Common Object Request Broker Architecture (CORBA), and
Java Remote Method Invocation (RMI).

How do you implement distributed applications in .NET?

Answer - .NET Remoting and ASP.NET Web Services.
Classes for the same are in System.Runtime.Remoting and System.Web.Services.

Define proxy in .NET Remoting.

Answer - Its a fake 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.
This process is also known as marshaling.

Define remotable objects in .NET Remoting.

Answer - Remotable objects are the objects that can be marshaled across the application domains.
You can marshal by value, where a copy of the object is created and then passed to the receiver.
You can also marshal by reference, where just a reference to an existing object is passed
.

Define SingleCall activation mode in .Net Remoting.

Answer - If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode.

Define Singleton activation mode in .Net Remoting.

Answer - A single object is instantiated regardless of the number of clients accessing it.
Lifetime of this object is determined by lifetime lease.

Define the lease of the object.

Answer - By implementing ILease interface when writing the class code. 

.NET Remoting versus Distributed COM

.NET Remoting is the successor of DCOM. Microsoft DCOM is a solution for distributed object and very good in terms of performance when components are in the same network. But its drawbacks in the internet connected world are visible. It uses proprietary binary protocol which is not supported by other object models, thus can't support interoperability across platform.
.NET Remoting uses TCP or HTTP protocol that is supported by most of the object models. This allows .NET Remoting to be adaptable to the network environment in which it is being used. 

Advantage of Remoting over Web Services

Answer - .NET Remoting allows objects to interact that can be hosted in different application domain within the same process or different process. The objects can also interact over intranet or internet. It supports many different protocols unlike Web Services that works over SOAP/HTTP protocol. .Net Remoting can work on TCP protocol that provides speed benefit from its counterpart.
Being tied up with IIS, .Net Web service can only work with producer /consumer model whereas .Net Remoting can share objects from any type of application. .Net Remoting being part of .Net Framework support full .Net type system and can expose any object to the client. .Net Web Service supports on those types that can be expressed with XSD.

When should we choose .Net Remoting over .Net Web Services? 

Answer - .Net Remoting provides distributed solution for a corporate use. So, if you need distributed environment to be implemented for internal use, .Net remoting is the best choice.
If you require a faster distributed solution, .Net Remoting with TCP protocal using binary format is faster than Web services. .Net Remoting is better solution when large transfer of data is required. Web Services provide an open-protocol-based exchange of information. Web Services are best when you need to communicate with an external organization or non .NET technology.

What are the ways to configure Remoting objects before client can use them?  

Answer - There are two ways that the remoting objects can be configured. They can be configured by calling configuration methods inside the application. .Net Framework allows configuring objects also by adding configuration section in the application configuration file or machine.config file. Application-level XML settings take precedence over machine.config. When you apply any change in the configuration section, you don’t need to recompile the code. On the other hand, any change in the setting applied programmatically would require recompiling the code.

Define Delegates.  

Answer - A delegate acts like a strongly type function pointer. Delegates can invoke the methods that they reference without making explicit calls to those methods. It is type safe since it holds reference of only those methods that match its signature. Unlike other classes, the delegate class has a signature. Delegates are used to implement event programming model in .NET application. Delegates enable the methods that listen for an event, to be abstract.

Define Events.  

Answer - Events are one of the members of the class. When any noteworthy activity occurs in the application, an event is raised which sends out the message to the other part of the application which handles the event. The event can carry arguments that contain information about the event. The method which handles the event must have the same signature as the event itself. Events are commonly used in the applications with graphical user interface elements such as buttons, textbox etc. An event is triggered when any action such as mouse click occurred in the interface element. The event-based programming model can be used in the non-GUI applications such as .NET Remoting application. An event in remoting.net occurs when the state of the application changes.

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 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

0 Comments: