Differences Between WCF and Web API

There are good reasons to use ASP.Net Web API instead of WCF. But, what are the differences?

Support SOAP and REST. Support only REST.
Protocols supported: TCP, HTTP, HTTPS, Named Pipes, MSMQ. Only HTTP / HTTPS protocols are supported. It uses full-feature of HTTP (URIs, request / response headers, caching, content formate, etc)
Data formats supported: XML, JSON, ATOM. Data formats supported are typically JSON and XML. But can be extended with Web API’s MediaTypeFormatter.
Required extensive configurations. Very little configurations. Development is similar to coding in ASP.Net MVC.
Passing parameters to WCF operations need configurations and must be specified in UriTemplate. Parameters are bound automatically, similar to ASP.Net MVC Model Binding feature.
Web API’s URI is by convention (controller / action name).
HTTP verbs supported: GET, POST. Other verbs are supported with more IIS configurations. Support full HTTP verbs. GET, POST, PUT, DELETE, PATCH, HEAD, etc.
Can be hosted on IIS, Windows Service, or with in a web application. Can be hosted on IIS or with in a web application.
WCF is bigger framework, allowing full customization, such as SOAP, REST or WS-*. To support MVC features, it requires heavy customization and configuration. Supports the MVC features such as routing, controllers, action results, filter, model binders, IOC container or dependency injection, unit testing.

More reading about Web Service, WCF, WCF REST, Web API.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s