With Microsoft.NET Stack there are lots of way to create service like ASP.NET Web Service, WCF(Windows Communication Foundation) service and now ASP.NET Web API. The developer often get confused mainly between WCF Service and Web API. So I thought it is a good idea to write a blog post to about differences between ASP.NET Web API and WCF Service.
Difference between ASP.NET Web API and WCF Service:
- WCF services support multiple transport support like HTTP,TCP,UDP,MSMQ and allow switching between them while ASP.NET Web API is used only http based services best suited for http service and mobile based application back end service. It is an quick and easy way to create http service.
- WCF support multiple encodings like Text,MTOM while ASP.NET Web API support wide range of media types like XML,JSON etc.
- WCF Service support Request-Reply, One way and duplex exchange patterns while HTTP service only support Request/Return pattern.
When to choose? What? WCF or Web API
- Choose WCF if you want to support any other transport protocol then HTTP.
- Choose Web API when you want to create resource oriented services very quickly.
- Choose Web API when you want to serve wide variety of clients like browsers, mobile etc.
- Choose WCF when you want to support message queuing, one way messaging and duplicate message communication.
nice post
ReplyDelete