Full control over how you send and respond to HTTP protocol messages
A simplified abstraction; the simplest Web API you can build can wrap an HttpMessageHandler, which is more or less a simple funciton taking an HttpRequestMessage and returning a Task<HttpResponseMessage>
Those are the big wins for me. If you really want to just serialize objects and deserialize the same strongly-typed objects on the other side of the wire, or if you want to use SOAP, you would be better off sticking with WCF. In those cases, you really don't
care about the protocol.
WCF is an RPC framework (and to my knowledge it is the best one) enabling you to pass parameters to call methods on a server and return the result as if the code ran locally.
Web API is based on REST guidelines (best implemented in HTTP) allowing you to embrace HTTP's full goodness such as client-server architecture, web caching, resources, hypermedia, etc. It allows the same API to be called by
wide variety of clients including smarphones.
If all you care is RPC, then WCF is fine but for a new world API serving all kind of devices Web API is superior. More info here (section of comparing WCF and REST):
Web API is based on REST guidelines (best implemented in HTTP) allowing you to embrace HTTP's full goodness such as client-server architecture, web caching, resources, hypermedia, etc. It allows the same API to be called by
wide variety of clients including smarphones.
Web API is in fact not based on REST. The goals of the project have always been aligned with giving first-class access to the HTTP protocol. You can certainly implement all the constraints defined in REST using Web API, but that's not the baseline. Your
point about RPC is valid, as Web API will not do as much for you wrt RPC use of HTTP.
I found this blog post useful in understanding the difference in protocol versus style.
Bhavagna
Member
40 Points
22 Posts
advantages of asp.net webapi over wcf
May 02, 2012 03:27 PM|LINK
Hi,
please let me know the advantages of asp.net web api over wcf.
panesofglass
Member
730 Points
237 Posts
Re: advantages of asp.net webapi over wcf
May 02, 2012 03:40 PM|LINK
Those are the big wins for me. If you really want to just serialize objects and deserialize the same strongly-typed objects on the other side of the wire, or if you want to use SOAP, you would be better off sticking with WCF. In those cases, you really don't care about the protocol.
aliostad
Member
228 Points
55 Posts
Re: advantages of asp.net webapi over wcf
May 02, 2012 04:08 PM|LINK
WCF is an RPC framework (and to my knowledge it is the best one) enabling you to pass parameters to call methods on a server and return the result as if the code ran locally.
Web API is based on REST guidelines (best implemented in HTTP) allowing you to embrace HTTP's full goodness such as client-server architecture, web caching, resources, hypermedia, etc. It allows the same API to be called by wide variety of clients including smarphones.
If all you care is RPC, then WCF is fine but for a new world API serving all kind of devices Web API is superior. More info here (section of comparing WCF and REST):
http://byterot.blogspot.co.uk/2012/03/aspnet-web-api-series-part-0-why-not.html
panesofglass
Member
730 Points
237 Posts
Re: advantages of asp.net webapi over wcf
May 02, 2012 04:13 PM|LINK
Web API is in fact not based on REST. The goals of the project have always been aligned with giving first-class access to the HTTP protocol. You can certainly implement all the constraints defined in REST using Web API, but that's not the baseline. Your point about RPC is valid, as Web API will not do as much for you wrt RPC use of HTTP.
I found this blog post useful in understanding the difference in protocol versus style.
aliostad
Member
228 Points
55 Posts
Re: advantages of asp.net webapi over wcf
May 02, 2012 04:26 PM|LINK
That is always a controversial topic isnt it?!
What I meant was Web API ambraces HTTP which in turn is a good implementation of REST.
So Web API itself does not prescribe REST but if you use all HTTP features exposed within Web API, then you are doing REST.
I suppose this is more technically correct.
teguhyuliant...
Participant
1370 Points
372 Posts
Re: advantages of asp.net webapi over wcf
May 07, 2012 06:48 AM|LINK
There are many advantages of asp.net web api over wcf. For detail advantages of that, you can refer link below:
http://wcf.codeplex.com/wikipage?title=WCF%20HTTP&utm_source=twitterfeed&utm_medium=twitter