Monday, February 21, 2011

Basic WCF Interview Questions


Click here for all SQL Server Interview Questions


Click here for all WCF Interview Questions


Click here for all ASP.NET Interview Questions


Click here for all C# Interview Questions


Click here for Written Test or practical ASP.NET Interview Questions asked in MNC's


What is WCF?
WCF stands for Windows Communication Foundation (WCF) and is considered as the Microsoft Service-Oriented Architecture (SOA) platform for building distributed and interoperable applications. WCF unifies ASMX, Remoting, and Enterprise Services stacks and provides a single programming model. WCF services are interoperable and supports all the core Web services standards. WCF services also provide extension points to quickly adapt to new protocols and updates and integrates very easily with the earlier microsoft technologies like Enterprise Services, COM and MSMQ.


What is the version of the .NET framework in which WCF is released?
WCF - Windows Communication Foundation is released as part of .NET Framework 3.0. WPF (Windows Presentation Foundation), WF (Workflow Foundation) and Card Space are also part of .NET Framework 3.0.


What is the advantage of using WCF over other distributed programming models like Web Services(ASMX), .NET Remoting, Enterprise Services stack etc.?
To understand the advantage of using WCF over other distributed programming models like Web Services(ASMX), .NET Remoting, Enterprise Services stack etc, let's consider the following scenario. We have developed an application using web services. As we know web services use HTTP protocl and XML SOAP formatted messages, they are good for developing interoperable applications in a heterogeniuos environment. We have a new client. Our new client is using .NET and he wants binary formmatted messages over TCP protocol, because interoperability is not a concern and binary formmatted messages over TCP protocol are much faster than XML SOAP formmatted messages over HTTP. To satisfy the requirement of this client, now we cannot use our existing web service. So, we have to develop a brand new remoting application from the scratch. The business functionality is the same in web services and remoting application. Since our different clients have different requirements, we ended up creating the same business application using web services and remoting technologies. This approach has several disadvantages as listed below.
1. Developers have to be familiar with two different technologies (Web Services and Remoting).
2. We end up creating duplicate business applications with different technologies which also leads to maintainance overhead.


On the other hand WCF unifies Web Services, .NET Remoting, and Enterprise Services stacks under one roof. For the same requirement that we have seen untill now, we just create one application and expose multiple end points to satisfy the requirements of multiple clients. In WCF configuration drives protocol choices, messaging formats, process allocation, etc. WCF services are loosely coupled, meaning that a WCF service is not bound to a particular protocol, encoding format, or hosting environment. Everything is configurable.



Why are WCF Services are considered as loosely coupled?
WCF Services are considered as loosely coupled because WCF services are not tightly bound to a particular protocol, encoding format, or hosting environment. All of these are configurable. At the time of designing WCF services, we donot have to worry about what protocol, encoding format, or hosting environment to use to expose the service. We can worry about all these at the time of deployment.


What are the 3 things that a WCF Services end point must have?
                        OR
What are the ABC of a WCF service?
Address - The address where the WCF Service is hosted.
Binding - The binding that decides the protocol, message encoding and security to use. Binding also decides whether to use reliable messaging and transaction support.
Contract - The service contract defines what service operations are available to the client for consumption.


So the Address(A), Binding(B) and Contract(C) are called as the ABC of the service end point.


What is the role of WSDL in WCF?
           OR
What is WSDL?
WSDL stands for Web Service Description Language. The WCF service exposes the WSDL document for the clients, to generate proxies and the configuration file. The WSDL file provides the following information for the consumers of the WCF service.
1. Provides the information about the service contract and operations available.
2. Provides the information about all the end points exposed by the WCF service.
3. Provides the information about the messages and types that can be exchanged between the client and the WCF service.
4. WSDL also provides any information about the policies used.


What is the tool that a client application can use to generate the proxy for a WCF service?
Service Utility (svcutil.exe) can be used by the clients to generate the proxy and configuration file. For the client to be able to generate proxies, the service should enable metadata exchange.


Click here for all SQL Server Interview Questions


Click here for all WCF Interview Questions


Click here for all ASP.NET Interview Questions


Click here for all C# Interview Questions


Click here for Written Test or practical ASP.NET Interview Questions asked in MNC's

17 comments:

  1. how to create a wcf service and consume it in a web psge?-Nirmal(S/W,Engg)

    ReplyDelete
  2. just create a new web reference and call that reference in your page behind.

    ReplyDelete
  3. Nice question its really helps..

    ReplyDelete
  4. Thanks its excellent stuff

    ReplyDelete
  5. can you give a video that implement wcf example in any project page

    ReplyDelete
  6. It will be very great full if you will upload some videos of WCF.. Please do reply us. Thank you

    ReplyDelete
    Replies
    1. Hi, I will surely upload wcf video tutorial. The videos will be uploaded at the following link.
      asp.net, c# and sql server video tutorial

      If you want to receive email alerts when new videos are uploaded by me, please subscribe to my youtube channel at the following link.
      Venkat Youtube Channel

      Delete
  7. The most wonderful blog..especially with scenarios the concept is very clear...thanks a lottttttttttttttttttttttttttt

    ReplyDelete
  8. Hi Venkat, thanks a lot for all these .net videos, they are really very much understanding and useful.
    Can you please let me know when wcf videos will be posted on the site ?

    ReplyDelete
  9. hi Mr Venkat how to consume the wcf service without adding service reference

    ReplyDelete
  10. Hi, Really it will be very helpful if you can upload videos of WCF.. Please do reply. Thank you very much for sharing your knowledge with us. Great job.. :)

    ReplyDelete
  11. Manoranjan Behera(Software developer in Cts,Kolkatta)
    hi Mr Venkat ,I saw your MVC tutorial is Expressed clearly so i am very impressed ,If you upload some wcf tutorial,then i will be Shared Your knowledge. Thanks !!

    ReplyDelete
  12. Hi in my recent interview i was asked a question aiming the difference between wcf and web services. the question is like this.
    "I(the company) wants to use the service for itself and no client is going to use the service. Then I can create the service as a web service. Why should I create a WCF service." this was the question. Please suggest answer.
    Thanks in advance.

    ReplyDelete
    Replies
    1. WCF being loosely coupled, is very flexible and configurable. As a company too, you dont want to be developing applications again for different platforms you may use in future. Configuring a WCF instead will make it more flexible, just in case your business needs a different host/protocol/binding etc. Just like it is always beneficial to create generic applications to improve reusability.
      I know its too late for an answer, but just might help someone else too.

      Delete
    2. Also, as he has explained in the WCF video series, some HTTP services can be made public and some could be just for the use of the company. So by defining the protocol involved, we can put services behind and ahead of the firewall of the company. (TCP : behind, HTTP : ahead)

      Delete

If you are aware of any other WCF questions asked in an interview, please post them below. If you find anything missing or wrong, please feel free to correct by submitting the form below.

 
Disclaimer - Terms of use - Contact Us