WCF Interview Questions – Part 1

By | August 5, 2012

This WCF Tutorial is a collection of most frequently asked interview questions about Windows Communication Foundation (WCF) covering the beginner to professional level.

Following are the links to other posts in this WCF Questions Series:

  1. WCF Service Interview Questions – Part 1
  2. WCF Service Interview Questions – Part 2
  3. WCF Service Interview Questions – Part 3
  4. WCF Service Interview Questions – Part 4

Note: Please look into the Top 10 WCF Interview Questions also.

WCF Interview Questions List – Part 1

What is WCF?

Microsoft refers WCF as a programming platform that is used to build Service-Oriented applications. Windows Communication Foundation is basically a unified programming model for developing, configuring and deploying distributed services.  Microsoft has unified all its existing distributed application technologies (e.g. MS Enterprise Services, ASMX web services, MSMQ, .NET Remoting etc) at one platform i.e. WCF. Code name for WCF was Indigo. Below diagram clearly explains it:Windows Communication FoundationBack to top

Why to use WCF? or What are the advantages of using WCF?

Advantages of WCF

  • Service Orientation is one of the key advantages of WCF. We can easily build service-oriented applications using WCF.
  • If compared with ASMX web services, WCF service provides reliability and security with simplicity.
  • As oppose to .NET Remoting, WCF services are interoperable.
  • Different clients can interact with same service using different communication mechanism. This is achieved by using service endpoints. A single WCF service can have multiple endpoints. So, developer will write code for service once and just by changing configuration (defining another service endpoint), it will be available for other clients as well.
  • Extensibility is another key advantage of WCF.  We can easily customize a service behavior if required.

Back to Top

What are the core components of WCF Service?

A WCF service has at least following core components.
  • Service Class:  A service class implementing in any CLR-based language and expose at least one method.
  • Hosting Environment: a managed process for running service.
  • Endpoint: a client uses it to communicate with service.Core WCF Components

Back to Top

What are the new features introduced in WCF 4.5?

Windows Communication Foundation v4.5 was released with a number of cool features. Here we simply list down most important features but you can find thorough detail about each feature with helping code snippet in 7 parts series of new features in WCF 4.5. These important features are:

  • Simplified Configuration files
  • ToolTip and Intellisense support
  • Task-based asynchronous Programming Model
  • BasicHttpsBinding support
  • Single WSDL Document
  • WCF Configuration Validation
  • ASP.NET Compatibility Mode changed
  • Contract First Development
  • Multiple Authentication Types
  • XmlDictionaryReaderQuotas default value changed
  • UDP Transport Support
  • and many more…

For more on key WCF 4.5 features, please follow here.

Back to Top

What is the difference between WCF and ASMX Web services?

The basic difference is that ASMX web service is designed to send and receive messages using SOAP over HTTP only. While WCF service can exchange messages using any format (SOAP is default) over any transport protocol (HTTP, TCP/IP, MSMQ, Named Pipes etc).ASMX Web Services Vs WCFYou can find detailed discussion on WCF Vs ASMX Web services here.
Back to Top

What are the Endpoints in WCF? or Explain ABCs of endpoint?

For WCF services to be consumed, it’s necessary that it must be exposed; Clients need information about service to communicate with it. This is where service endpoints play their role.
A service endpoint has three basic elements or also called ABCs of an endpoint i.e. Address, Binding and Contract.ABC's of WCF EndPoint

  • Address: It defines “WHERE”. Address is the URL that identifies the location of the service.
  • Binding: It defines “HOW”. Binding defines how the service can be accessed.
  • Contract: It defines “WHAT”. Contract identifies what is exposed by the service.WCF Endpoint

Back to Top

What is the difference between Service EndPoint and Client Endpoint?

As we already understood the concept of an Endpoint and it’s ABC (Address, Binding, Contract). Both Service and Client Endpoint has same ABC but we think in different perspective while working with them. We can differentiate between Service and Client Endpoint with respect to Address, Binding and Contract as:

Service Endpoint

Client Endpoint

WHERE: URL of hosted service. WHERE: where to connect with hosted service.
WHAT: bindings being used. WHAT: binding supported by service.
CONTRACT: Service Contract i.e. interfaces CONTRACT: what to pass and expect while communicating with service.

Back to Top

What is a WCF Binding? How many different types of bindings available in WCF?

Bindings in WCF actually defines that how to communicate with the service. Binding specifies that what communication protocol as well as encoding method will be used. Optionally, binding can specify other important factors like transactions, reliable sessions and security.
Another WCF Tutorial gives more detailed understanding of Binding concept in WCF.

There are different built-in bindings available in WCF, each designed to fulfill some specific need.

  • basicHttpBinding
  • wsHttpBinding
  • netNamedPipeBinding
  • netTcpBinding
  • netPeerTcpBinding
  • netmsmqBindingWCF Bindings

For details on different binding types, please follow the link to WCF bindings.
Back to Top

What is a WebHttpBinding in WCF?

WebHttpBinding is the one that is used for creating WCF RESTful services. In Windows Communication Foundation v3.5, Microsoft introduces support for building RESTful services. REST (Representational State Transfer) is an architectural design that uses HTTP the way it should be used.

Instead of using HTTP just as a transport (in case of SOAP-based WCF Services), RESTful WCF services uses full features of HTTP (for all CRUD Operations including Create, Retrieve, Update and Delete).

You can find WebHttpBinding in action as in below configuration screenshot. WebHttpBinding

Back to Top

Can we have multiple endpoints for different binding types in order to serve different types of clients?

Yes, we can have multiple endpoints for different binding types. For example, an endpoint with wsHttpBinding and another one with netTcpBinging.
Back to Top

What are the hosting options for WCF Services? Explain.

For a service to host, we need at least a managed process, a ServiceHost instance and an Endpoint configured. Possible approaches for hosting a service are:

Back to Top

Next WCF Tutorial on Interview Questions and Answers in this series is about Proxy and Channel Factory, Concurrency and Throttling in WCF.

WCF Online Test

Top 10 Interview Questions and Answers Series:

Category: Interview Questions Tags: ,


Imran Abdul Ghani is working as Software Developer(Senior) with extensive knowledge in Web development technologies especially C#, ASP.NET, MVC, WCF, Web API, ADO.NET Entity Framework, jQuery etc. He has several years of experience in designing/developing enterprise level applications. He is Microsoft Certified Solution Developer for .NET (MCSD.NET) since 2005. You can reach his blogging at www.webdevelopmenthelp.net, www.topwcftutorials.net, and www.sharepointfordummies.net.