.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> WCF >> Post New Resource Bookmark and Share   

 Subscribe to Articles

.NET/WCF 4.0 interview Question - What is the default binding in WCF 4.0?

Posted By:Shivprasad koirala       Posted Date: June 03, 2011    Points: 200    Category: WCF    URL: http://www.questpond.com  

Recently i had a gone to a mid IT company for an interview, the interviewer asked me the question on what is the default binding in WCF 4.0.
 

In one of the .NET interviews an interviewer asked me the above question, what is the default binding in WCF 4.0.

As I had never worked on WCF 4.0 it was difficult to answer the above question. But I had worked on WCF 3.5 where the default binding is 'wsHttpBinding'. So I thought that it would be same in WCF 4.0 and gave the same answer i.e. 'wsHttpBinding'.

But I was completely wrong and the interviewer probably did not appreciate the answer. As soon as I reached home googled around and to my surprise it was'basicHttpBinding'.

Also watch my step by step video on WCF one way contract http://youtu.be/V2Rep9i1oFM?hd=1
 



So in order to see it practically I first created a new project of WCF > WCF Service application and selected the framework as 3.5 and just click on OK, Now by viewing the Web.config file I found that the default binding as 'wsHttpBinding'. The following will give you a better idea of the same.





Now I wanted to see practically the default binding in WCF 4.0, so again I have created a new project as WCF >WCF Service application and selected the framework as 4.0 and to my surprise there was no end point in Web.config, there is no Binding. In other words the complete Web.config file was difference. So I just run the application and by viewing the WSDL, viewed the binding as 'basicHttpBinding'.





In the below diagram you can see that, the binding name as 'BasicHttpBinding'.
So, the correct answer for default binding in WCF 4.0 is 'BasicHttpBinding'.



The second type of question asked by the interviewer was how you will change 'BasicHttpBinding' to 'wsHttpBinding' in WCF 4.0. This question was also socking to me, as I was unaware of this question and did't gave any answer. So again at home I googled this question and got correct answer as by 'protocolMapping'. Later I did practical demonstration to get a better idea to the same.

I have just added the 'protocolMapping' tag in web.config file and change the binding name as 'wsHttpBinding'.



Later just run the application and by viewing the WSDL, I found the binding name is now being replaced with 'wsHttpBinding'.




For more WCF interview Qusetions

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend