While designing the
service layer for new application, this debate is always happened in my team.
Are
we going to choose Web API over WCF or going with WCF?
Let back on our topic
‘Web API vs WCF’. there is no doubt, WCF provides a lots of feature and it is
much more versatile in case of supporting to many transport protocols (HTTP,
TCP, Named Pipes etc.) and can easily build secure, reliable and transaction
enabled service and much more in messaging like two –way communication (duplex
channel) .
Web API if you need to
build a lightweight, restful service based HTTP protocol and it can
leverage of the full feature of HTTP protocol like cache control, versioning
etc and you want to expose your service to a broad range of client i.e. web
browser, tables, mobile then web API always have advantage over WCF. WCF has
very extensive configuration compare to web API and WEB API is very simple and
light weight service and easily accessible in limited bandwidth device like
smart phones and tablet. Web API supports any text format including XML so in
performance, Web API is faster than WCF.
WCF:
WCF |
·
Should support special
scenarios such as one way messaging, message queues, duplex communication etc.
·
Should support fast
transport channels when available, such as TCP, Named Pipes, or maybe even UDP
(in WCF 4.5), and you also want to support HTTP when all other transport
channels are unavailable.
·
Should be transaction
enabled service or it will be called under other transaction scope.
Web API:
WEB API |
·
Should be restful
service over HTTP that can use the full features of HTTP (like URIs,
request/response headers, caching, versioning, various content formats).
·
Should be expose your
service to a broad range of clients including browsers, mobiles, iPhone and
tablets.
Thanks for visiting !!
No comments:
Post a Comment