Friday, October 29, 2010

Difference between Web Service and WCF Service

While taking interviews of .NET developers I often ask this questions. But lots of people don’t know exact difference between this. So, I decided to write a separate blog about this.

Here are the few differences.

  • Web services can be hosted in IIS as well as outside of the IIS. While WCF service can be hosted in IIS, Windows activation service,Self Hosting,WAS and on lots of proctols like Named Pipe,TCP etc.Here lots of people disagree how we can host the web service outside of the IIS but Here is the article for that.http://msdn.microsoft.com/en-us/library/aa529311.aspx.
  • In Web Services Web Service attribute will added  on the top of class. In WCF there will be a Service Contract attributes will be there. Same way Web Method attribute are added in top of method of Web service while in WCF Service Operation Contract will added on the top method.
  • In Web service System.XML.Serialization is supported while in the WCF Service System.RunTime.Serialization is supported.
  • WCF Services can be multithreaded via ServiceBehavior class while web service can not be.
  • WCF Services supports different type of bindings like BasicHttpBinding, WSHttpBinding, WSDualHttpBinding etc.while Web services only used soap or xml for this.
  • Web services are compiled into a class library assembly. A file called the service file is provided that has the extension .asmx and contains an @ WebService directive that identifies the class that contains the code for the service and the assembly in which it is located while in WCF.WCF services can readily be hosted within IIS 5.1 or 6.0, the Windows Process Activation Service (WAS) that is provided as part of IIS 7.0, and within any .NET application. To host a service in IIS 5.1 or 6.0, the service must use HTTP as the communications transport protocol.

Hope this will help you. Happy programming!!!

Technorati Tags: ,,
Shout it
kick it on DotNetKicks.com
Share:

7 comments:

  1. Hi aticle is good but you need to include this points :

    WCF webservice buit by the WCF Framwork which allows to build service oriented architecture.


    WCF Service has three kind of binding each of this has sub binding

    mail biding are

    HTTP-Based bindings
    TCP--Based bindings
    MSMQ--Based bindings


    Web services can only be invoked by HTTP (traditional webservice with .asmx). While WCF Service or a WCF component can be invoked by any protocol (like http, tcp etc.) and any transport type.

    ReplyDelete
  2. Hi aticle is good but you need to include this points :

    WCF webservice buit by the WCF Framwork which allows to build service oriented architecture.


    WCF Service has three kind of binding each of this has sub binding

    mail biding are

    HTTP-Based bindings
    TCP--Based bindings
    MSMQ--Based bindings


    Web services can only be invoked by HTTP (traditional webservice with .asmx). While WCF Service or a WCF component can be invoked by any protocol (like http, tcp etc.) and any transport type.

    ReplyDelete
  3. I don't think that anyone can add comment to your blog other than ASP.Net Developer...

    to find out reason behind this try yourself to enter the comment.

    ReplyDelete
  4. it's good.But i want How WCF Better than webservices

    ReplyDelete
  5. It's good information for me

    ReplyDelete
  6. HI,

    I would like to know whether WCF could be used for internet application ??

    Thanks !
    Sushil

    ReplyDelete
  7. that's too informative, Guys, I have a query using wsdl URI of an agents.How can I verifiy that it is of WCF or a Webservice?

    ReplyDelete

Your feedback is very important to me. Please provide your feedback via putting comments.

About Me
My Photo

Full Stack Developer,Blogger,Microsoft Mvp, Mentor, Life long learner, 10+ Years of Experience for JavaScript, web and Microsoft technologies. ASP.NET MVC,Web Forms,C#,AngularJs,Golang
Mvp profile
Subscribe to my blog

Enter your email address:

Follow us on facebook
Blog Archive
Total Pageviews