.Net Remoting Interview Questions

By | April 28, 2014

  1. What’s a Windows process? It’s an application that’s running and had been allocated memory.
  2. What’s typical about a Windows process in regards to memory allocation? 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.
  3. Why do you call it a process? What’s different between process and application in .NET, not common computer usage, terminology? A process is an instance of a running application. An application is an executable on the hard drive or network. There can be numerous processes launched of the same application (5 copies of Word running), but 1 process can run just 1 application.
  4. What distributed process frameworks outside .NET do you know? 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).
  5. What are possible implementations of distributed applications in .NET? .NET Remoting and ASP.NET Web Services. If we talk about the Framework Class Library, noteworthy classes are in System.Runtime.Remoting and System.Web.Services.
  6. When would you use .NET Remoting and when Web services? 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.
  7. What’s a proxy of the server object in .NET Remoting? It’s 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.
  8. What are remotable objects in .NET Remoting? Remotable objects are the objects that can be marshaled across the application domains. You can marshal by value, where a deep 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.
  9. What are channels in .NET Remoting? 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.
  10. What security measures exist for .NET Remoting in System.Runtime.Remoting? None. Security should be taken care of at the application level. Cryptography and other security techniques can be applied at application or server level.
  11. 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.
  12. Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters, what are the trade-offs? Binary over TCP is the most effiecient, SOAP over HTTP is the most interoperable.
  13. What’s SingleCall activation mode used for? If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode.
  14. What’s Singleton activation mode? A single object is instantiated regardless of the number of clients accessing it. Lifetime of this object is determined by lifetime lease.
  15. How do you define the lease of the object? By implementing ILease interface when writing the class code.
  16. Can you configure a .NET Remoting object via XML file? Yes, via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config.
  17. How can you automatically generate interface for the remotable object in .NET with Microsoft tools? Use the Soapsuds tool.
  18.  Question:-What is Serialization Formatters in .NET Remoting ? Answer:When any object is to be sent across the transport channel, it must be serialized and packed into a data format that can be transmitted with the wire. On the other end of the wire, this serialized data is read and deserialized back to the actual object. This Serialization is done by message-serialization formatters which convert the field or object’s state into a format that is helpful for storage or transmission. Dot Net framework provides us two message-serialization formatters one of them is a binary serialization formatter which converts an object’s state into a binary stream and other is SOAP serialization formatter which converts it into an XML string representation that’s human readable. The binary serialization formatter much slightly faster.Question:-What is .NET Remoting ? Answer:.NET Remoting is an enabler for application communication. It is a generic system for different applications to use to communicate with one another. .NET objects are exposed to remote processes, thus allowing interprocess communication. The applications can be located on the same computer, different computers on the same network, or even computers across separate networks.Question:- .NET Remoting versus Distributed COM ? Answer:In the past interprocess communication between applications was handled through Distributed COM, or DCOM. DCOM works well and the performance is adequate when applications exist on computers of similar type on the same network. However, DCOM has its drawbacks in the Internet connected world. DCOM relies on a proprietary binary protocol that not all object models support, which hinders interoperability across platforms. In addition, have you tried to get DCOM to work through a firewall? DCOM wants to communicate over a range of ports that are typically blocked by firewalls. There are a ways to get it to work, but they either decrease the effectiveness of the firewall (why bother to even have the firewall if you open up a ton of ports on it), or require you to get a firewall that allows support for binary traffic over port 80. .NET Remoting eliminates the difficulties of DCOM by supporting different transport protocol formats and communication protocols. This allows .NET Remoting to be adaptable to the network environment in which it is being used.Question:-What is Channels ? Answer:Remote objects are accessed through Channels. Channels physically transport the messages to and from remote objects. There are two existing channels TcpChannel and HttpChannel. Their names give away the protocols that they use. In addition, the TcpChannel or HttpChannel can be extended, or a new channel created if you determine the existing channels do not meet your needs.Question:- Security in Remoting ? Answer:Security is of paramount importance to any distributed application. Although the .NET Remoting infrastructure does not define any security features itself, because distributed applications are managed code they have full access to all of the .NET security features. In addition, the HTTP channel, when used with IIS, allows you to take full advantage of the authentication and authorization features that are available to Web based protocols. If you choose to use a protocol other than HTTP with IIS, then you have the opportunity to create your own security infrastructure.Question:-Advantage of Remoting over Web Services ? Answer:.NET Remoting is a distributed objects infrastructure. It allows processes to share objects—to call methods on and access properties of objects that are hosted in different application domains within the same process, different processes executing on the same computer, on computers on an intranet, or on computers distributed over wide areas. .NET Remoting supports many different communications protocols, including the SOAP/HTTP protocol used by ASP.NET Web services. Support for other protocols makes it possible to provide much faster communications in .NET Remoting than would be possible with ASP.NET Web services. The ASP.NET programming model is tied specifically to IIS, and is limited to creating Web services that use the producer/consumer model. .NET Remoting, on the other hand, can share objects from any type of application.The .NET Remoting system, as an integral part of the .NET Framework, supports full .NET type system fidelity. You can pass any object across the wire to a client. This is in contrast to ASP.NET, which is limited to data types that can be expressed with WSDL and XSD.Question:- Scope of publication ? Answer:.NET Remoting exposes objects to other application domains as if they are local, with a few exceptions. The two exceptions most likely to trip you up are: • Static members are never remoted. Remoting always deals with some form of object instance member. • Private methods are never remoted. You cannot wrap and pass a delegate to a private method. This includes remote event handlers. The other exceptions are less likely to cause you trouble. The online documentation provides a complete list and explanation of the exceptions.Question:-What are the Proxies ? Answer:In the general sense, a proxy is any object that stands in for another, either servicing requests directly or passing the requests on to the object for which it is standing in. In .NET Remoting, the proxy manages the marshaling process and the other tasks required to make cross-boundary calls. The .NET Remoting infrastructure automatically handles creation and management of proxies, although it is possible to create your own proxy classes to plug in to and customize proxy creation, marshaling, and other proxy-related tasks.Question:-What is Abstract ? Answer:.NET Remoting provides a powerful and high performance way of working with remote objects. Architecturally, .NET Remote objects are a perfect fit for accessing resources across the network without the overhead posed by SOAP based WebServices. .NET Remoting is easier to use than Java’s RMI, but definately more difficult than creating a WebService.Question:-Some Important Notes Answer:The dependence on assembly metadata implies that client applications must understand .NET concepts. As a result, applications that make use of .NET Remoting are not interoperable with other systems. Although it’s possible to write an XML Web service using .NET Remoting, it’s not practical when you consider that ASP.NET is designed specifically for that task. In most cases, in order to use .NET Remoting, both the client and the server must be .NET applications. This makes .NET Remoting a poor choice if you want non-.NET clients to access your service.Before we get into the nuts and bolts of how Remoting works and how to write programs that take advantage of it, you need to understand some basic Remoting concepts.Question:-.NET Remoting Overview ? Answer: .NET Remoting is very flexible. You have a wide range of communications options and activation methods, as well as full control over a distributed object’s lifecycle. You can choose TCP or HTTP communications protocols on any port, using text or binary formatting. The .NET Remoting infrastructure supports server activated (single call and singleton) and client activated objects. .NET Remoting gives you many opportunities to “plug in” to the system to customize lifecycle management, marshaling, serialization, messaging, and other services.

1.       What is .NET Remoting?.NET Remoting is an enabler for application communication. It is a generic system for different applications to use to communicate with one another. .NET objects are exposed to remote processes, thus allowing interprocess communication. 2.       What’s a Windows process?It’s an application that’s running and had been allocated memory.3.       What are the consideration in deciding to use .NET Remoting or ASP.NET Web Services?Remoting is a more efficient communication exchange when you can control both ends of the application involved in the communication process.  Web Services provide an open-protocol-based exchange of informaion.  Web Services are best when you need to communicate with an external organization or another (non-.NET) technology. 4.       What are channels in .NET Remoting?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. 5.       What security measures exist for .NET Remoting in System.Runtime.Remoting?None. Security should be taken care of at the application level. Cryptography and other security techniques can be applied at application or server level.  6.       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.  7.       Can you configure a .NET Remoting object via XML file?Yes, via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config.8.       Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters, what are the trade-offs?Binary over TCP is the most effiecient, SOAP over HTTP is the most interoperable.9.       How do you define the lease of the object?By implementing ILease interface when writing the class code.10.   What’s SingleCall activation mode used for?If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode.  ==========================================================================================================What is an application domain?What is .NET Remoting ?Which class does the remote object has to inherit ? What are two different types of remote object creation mode in .NET ? Describe in detail Basic of SAO architecture of Remoting? What is the situation you will use singleton architecture in remoting ? What is fundamental of published or precreated objects in Remoting ? What are the ways client can create object on server in CAO model ? Are CAO stateful in nature ? In CAO model when we want client objects to be created by “NEW” keyword is there any precautions to be taken ? Is it a good design practice to distribute the implementation to Remoting Client ? What is LeaseTime,SponsorshipTime ,RenewonCallTime and LeaseManagerPollTime? Which config file has all the supported channels/protocol ? How can you specify remoting parameters using Config files ? Can Non-Default constructors be used with Single Call SAO?(Twist :- What are the limitation of constructors for Single call SAO ?) How can we call methods in remoting Asynchronously ? What is Asynchronous One-Way Calls ? What is marshalling and what are different kinds of marshalling ? What is ObjRef object in remoting ? What is a WebService ? What is UDDI ? What is DISCO ? What is WSDL? What the different phase of acquiring a proxy object in Webservice ? What is file extension of Webservices ? Which attribute is used in order that the method can be used as WebService ? What are the steps to create a webservice and consume it ? Do webservice have state ? ============================================================ What distributed process frameworks outside .NET do you know? 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). What are possible implementations of distributed applications in .NET?  .NET Remoting and ASP.NET Web Services. If we talk about the Framework Class Library, noteworthy classes are in  System.Runtime.Remoting and System.Web.Services. When would you use .NET Remoting and when Web services? 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. What’s a proxy of the server object in .NET Remoting?  It’s 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. What are remotable objects in .NET Remoting? Remotable objects are the objects that can be marshaled across the application domains. You can marshal by value, where  a deep 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. What are channels in .NET Remoting? 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 measures exist for .NET Remoting in System.Runtime.Remoting?  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?  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. Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters, what are the trade-offs? Binary over TCP is the most effiecient, SOAP over HTTP is the most interoperable. What’s SingleCall activation mode used for? If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode. What’s Singleton activation mode? A single object is instantiated regardless of the number of clients accessing it. Lifetime of this object is determined by  lifetime lease. How do you define the lease of the object? By implementing ILease interface when writing the class code. Can you configure a .NET Remoting object via XML file? Yes, via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config. How can you automatically generate interface for the remotable object in .NET with Microsoft tools? Use the Soapsuds tool.    What are CAO’s i.e. Client Activated Objects ? Client-activated objects are objects whose lifetimes are controlled by the calling application domain, just as they would be if the object were local to the client. With client activation, a round trip to the server occurs when the client tries to create an instance of the server object, and the client proxy is created using an object reference (ObjRef) obtained on return from the creation of the remote object on the server. Each time a client creates an instance of a client-activated type, that instance will service only that particular reference in that particular client until its lease expires and its memory is recycled. If a calling application domain creates two new instances of the remote type, each of the client references will invoke only the particular instance in the server application domain from which the reference was returned. In COM, clients hold an object in memory by holding a reference to it. When the last client releases its last reference, the object can delete itself. Client activation provides the same client control over the server object’s lifetime, but without the complexity of maintaining references or the constant pinging to confirm the continued existence of the server or client. Instead, 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, effectively preventing the remote object from ever being recycled until the server application domain is torn down. The difference between this and a server-activated indefinite lifetime is that an indefinite server-activated object will serve all client requests for that type, whereas the client-activated instances serve only the client and the reference that was responsible for their creation. For more information, see Lifetime Leases.

Leave a Reply