The. Net framework has a number of technologies this allow you to create HTTP services such as Web Service, WCF and now We b API. There is a lot of articles over the internet which may describe to whom your should use. Now a days, you had a lot of choices to build HTTP services on the. NET framework. In this article, I would like to share my opinion with your over web Service, the WCF and now Web API. For more information about the Web API refers what is the Web API and why do I use it?.
Web Service
It is based on SOAP and return data in XML form.
It support is only HTTP protocol.
It is not an open source but can be consumed by any client that understands XML.
It can be hosted only on IIS.
Wcf
It is also based on the SOAP and return data in XML form.
It is the evolution of the Web Service (ASMX) and support various protocols like TCP, HTTP, HTTPS, Named Pipes, MSMQ.
The main issue with WCF are, its tedious and extensive configuration.
It is not an open source but can be consumed by any client that understands XML.
It can be hosted with the applicaion or on IIS or using a window service.
WCF Rest
To use WCF as WCF Rest service, you have the to enable webhttpbindings.
It support HTTP GET and POST verbs by [webget] and [WebInvoke] attributes respectively.
To enable the other HTTP verbs. Some configuration in IIS to accept request of this particular verb on. svc file S
Passing data through parameters using a WebGet needs configuration. The UriTemplate must be specified
It support XML, JSON and ATOM data format.
Web API
The the new framework for building HTTP services with easy and simple.
Web API is open source a ideal platform for building rest-ful services over the. NET Framework.
Unlike WCF Rest service, it use the full featues of HTTP (like URIs, Request/response headers, caching, versioning, Variou s content formats)
It also supports the MVC features such as routing, Controllers, action results, filter, model binders, IOC container or de pendency injection, unit testing that makes it more simple and robust.
It can be hosted with the application or on IIS.
It's light weight architecture and good for devices which has limited bandwidth like smart phones.
Responses is formatted by Web API ' s mediatypeformatter into JSON, XML or whatever format you want to add as a mediatypefo Rmatter.
To whom choose between WCF or WEB API
Choose WCF When do want to create a service that should support special scenarios such as one-to-do messaging, message Queu ES, duplex communication etc.
Choose WCF when want to create a service that can use fast transport channels when available, such as TCP, Named Pipes , or maybe even UDP (in WCF 4.5), and your also want to the support HTTP when all other transport channels is unavailable.
Choose Web API When you want to create a resource-oriented services over HTTP that can use the full features of HTTP (like URIs, Request/response headers, caching, versioning, various content formats).
Choose Web API When your want to expose your service to a broad range of clients including browsers, mobiles, iphone and TA Blets.
From http://www.dotnet-tricks.com/Tutorial/webapi/ Ji2x050413-difference-between-wcf-and-web-api-and-wcf-rest-and-web-service.html
Difference between WCF and Web API and WCF REST and Web Service