There is given frequently asked WCF interview questions and answers that has been asked in many companies. Let’s see the list of top WCF interview questions.
1) What is WCF?
WCF stands for Windows Communication Foundation. It is a framework which is used for building, configuring and deploying interoperable distributed services. It provides a facility to write more secure flexible services without any code change. It also provides built-in support for logging. It facilitates you for enable/disable logging using configuration.
Its code name is “Indigo”.
2) What are the WCF service endpoints?
WCF service endpoint has three basic elements: address, binding and contract.
- Address: It defines the address of the URL that identifies the location of the service.
- Binding: It defines how the service can be accessed.
- Contract: It defines what is exposed by the service.
3) What is service?
A service is a set of functionality exposed to the world. Service orientation (SO) is an abstract set of principles and best practices for building service-oriented applications.
4) What do you mean by client?
The client of a service is the program unit consuming its functionality. A client can be anything like Console application, Windows form, WPF or Silverlight class or ASP.Net page etc.
5) How does WCF works?
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.
6) What is the difference between ASMX web services and WCF?
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 service is also known as ASP.Net web service.
7) How many types of contract WCF define?
There are four types of contracts that WCF define:
- Service Contracts
- Data Contracts
- Fault Contracts
- Message Contracts
8) What are the requirements for hosting a WCF service?
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:
Hosting in a Managed Application/ Self Hosting:
- Console Application
- Windows Application
- Windows Service
Hosting on Web Server
- IIS 6.0 (ASP.NET Application supports only HTTP)
- Windows Process Activation Service (WAS) i.e. IIS 7.0 supports HTTP, TCP, NamedPipes, MSMQ.
9) What is binding?
Binding is used to define how an endpoint communicates to the world. It defines the transport such as HTTP or TCP. It can contain binding elements that specify details like the security mechanisms used to secure message patterns used by an end point.
10) How many types of binding are there in WCF?
WCF supports nine types of bindings:
- Basic binding
- TCP binding
- Peer network binding
- IPC binding
- Web Services binding
- Federated Web Service binding
- Duplex WS binding
- MSMQ binding
- MSMQ integration binding
11) What are the transport schemas supported by WCF?
WCF supports the following transport schemas:
- PEER network
- IPC (Inter Process Communication)
12) What are the ways of hosting a WCF service?
The ways of hosting a WCF service are:
- WAS(Window Activation Service)
13) What are the duplex contracts in WCF?
In WCF, Duplex messaging or call-back is used to communicate with the client. Over different transport system Duplex messaging in WCF is done like TCP, Named pipe and even HTTP. Collectively this is known as duplex contracts in WCF.
14) What is transport and message reliability?
Transport reliability: It offers point-to-point guaranteed delivery at the network packet level, as well as guarantees the order of the packets.
Message reliability: It deals with reliability with message level independent of how many packets are required to deliver the message.
15) What is SOA?
SOA stands for Service Oriented Architecture. It is a collection of services that determines how the communication is possible between two computing entities to achieve certain business functionality and also how one entity can work on the behalf of other entity.
16) What are the different types of transaction managers supported by WCF?
These are three types of transaction managers supported by WCF:
- Light Weight
- WS-Atomic Transaction
- OLE Transaction
17) What are the MEP’s in WCF?
MEP stands for Message Exchange Pattern. There are three types of Message Exchange Patterns are allowed:
- Data Gram
- Request and Response