• +91 9723535972
  • info@interviewmaterial.com

WCF Interview Questions and Answers

Related Subjects

WCF Interview Questions and Answers

Question - 31 : - What is "Service Contracts" in WCF?

Answer - 31 : - The Service Contracts attribute is used at the service level for WCF service. It provides the list of operations that can be performed from that service.

Question - 32 : - What are the different instance modes in WCF?

Answer - 32 : - A list of instance modes in WCF: o Per Call o Singleton o Per Session

Question - 33 : - What is "Per Call" instance mode in WCF?

Answer - 33 : - When a request has made to service, it creates a new instance of service for each method call and this will be disposed of once the response goes to the client. This whole process is known as per call instance mode.

Question - 34 : - What is "Per Session" instance mode in WCF?

Answer - 34 : - Per session instance mode creates a logical session between service and client and it will be maintained till the end of the session. When client requests from service the session will be created and it is dedicated to the instance for that client and it will be going to the end when client session ends.

Question - 35 : - What is "Singleton" instance mode in WCF?

Answer - 35 : - In "Singleton" mode all the clients are connected to the single instance of the service and when service configured for "Singleton" mode, an instance will be created when service is hosted and it will be disposed of once it shuts down.

Question - 36 : - What do you mean by client?

Answer - 36 : - The client of a service is the program unit consuming its functionality. A client can be anything like a Console application, Windows form, WPF or Silverlight class or ASP.Net page etc.

Question - 37 : - How do WCF works?

Answer - 37 : - WCF follows the model "Software as a Service". In this model all units of functionality are defined as services and for communication, each point is a portal or connection either with the client or other services. It is a program that exposes a collection of endpoints.

Question - 38 : - What is the difference between ASMX web services and WCF?

Answer - 38 : - The main difference between WCF and ASMX web service is that ASMX is designed to send and receive messages using SOAP over HTTP only while WCF facilitates you to send and receive messages using any format over any transport protocol. ASMX web services can be hosted only in IIS while WCF service has all the following hosting options: o IIS o WAS (Windows Process Activation Services) o Console Application o Windows NT Services o WCF provided Host o ASMX web services support is limited to HTTP while WCF supports HTTP, TCP, MSMQ, NamedPipes. o ASMX Security is limited. Normally authentication and authorization are done using IIS and ASP.NET security configuration and transport layer security. For message layer security, WSE can be used. o WCF provides a consistent security programming model for any protocol and it supports many of the same capabilities as IIS and WS-* security protocols, additionally, it provides support for claims-based authorization that provides finer-grained control over resources than role-based security. WCF security is consistent regardless of the host that is used to implement WCF service. o Another major difference is that ASMX web services use XmlSerializer for serialization while WCF uses DataContractSerializer which is far better in performance than XmlSerializer.

Question - 39 : - How many types of contract WCF define?

Answer - 39 : - There are four types of contracts that WCF define: Service Contracts The ServiceContract attribute maps a CLR interface (or inferred interface, as you will see later on) to a technology-neutral service contract. The ServiceContract attribute exposes a CLR interface (or a class) as a WCF contract, independently of that type's visibility. Data Contracts The descriptions in metadata of the data type that a service uses. This enables others to interoperate with the service. The data types can be used in any part of a message, for example, as parameters or return types. If the service is using only simple types, there is no need to use data contracts explicitly. Fault Contracts Can be associated with a service operation to denote errors that can be returned to the caller. Message Contracts Describes the format of a message. For example, it declares whether message elements should go in headers versus the body, what level of security should be applied to what elements of the message, and so on.

Question - 40 : - What are the requirements for hosting a WCF service?

Answer - 40 : - You need at least a managed process, a ServiceHost instance and an Endpoint configured for hosting a WCF service. Following are the possible approaches for hosting a service: o Hosting in a Managed Application/ Self Hosting: o Console Application o Windows Application o Windows Service o Hosting on Web Server o IIS 6.0 (ASP.NET Application supports only HTTP) o Windows Process Activation Service (WAS) i.e. IIS 7.0 supports HTTP, TCP, NamedPipes, MSMQ.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners