Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Service vs ASP.NET Web Api

Can any one share the actual difference between WCF Service and ASP.NET Web Api? In which scenario we have to use WCF Service and ASP.NET Web Api.

like image 753
VIJAY Avatar asked May 24 '12 02:05

VIJAY


People also ask

What is the difference between ASP Net Web API and WCF?

Use WCF to create reliable, secure web services that are accessible over a variety of transports. Use ASP.NET Web API to create HTTP-based services that are accessible from a wide variety of clients. Use ASP.NET Web API if you are creating and designing new REST-style services.

Does ASP Net Web API replace the WCF?

No, it's not true that ASP.NET Web API has replaced WCF. WCF was generally developed to develop SOAP-based services. ASP.NET Web API is a new way to develop non-SOAP-based services such as XML, JSON, etc.

Which is faster WCF or Web API?

WEB API can use any text format including XML and is faster than WCF. WEB API can be used to create full-blown REST Services. WEB API doesn't require any data contracts and doesn't require configurations to the level of WCF.

Why Web API not different between WCF?

WCF does not provide any support for MVC features like controllers, routing, filter, auction results, etc. ASP.NET Web API supports MVC features like routing, controllers, results, filter, action, etc. It is not open source software. It is shipped with.Net framework.It is also available as an independent download.


2 Answers

WCF Web API is the next generation of Microsoft's service framework.

WCF Services were originally designed with a channel architecture allowing customization of the protocols and transports used to communicate between systems. While this gives the architect/developer great flexibility in building inter-operable applications, it comes at the cost of complexity. Configuring WCF has never been simple (IMO).

The most prevalent use case (IMO), is using WCF services to provide support to web applications via ajax requests from the browser for additional data. Also, since the time that WCF was originally introduced, it has become common for applications to provide an API using http.

Because the of this, the new WCF Web API is an attempt to simplify the service infrastructure and assume the http transport protocol.

If you are building a new web application, I would use the new Web API. I would only look at using WCF Services if I needed to communicate with another system using something other http.


WCF Channel Architecture

http://msdn.microsoft.com/en-us/library/ms729840.aspx

WCF Web API

http://www.asp.net/web-api

like image 128
Craig Swing Avatar answered Oct 29 '22 23:10

Craig Swing


From http://mattmilner.com/Milner/Blog/post/2012/02/28/WebAPI-or-WCF.aspx, a great post on this issue: "WCF remains the framework for building services where you care about transport flexibility. Web API is the framework for building services where you care about HTTP."

like image 32
carlosfigueira Avatar answered Oct 29 '22 23:10

carlosfigueira