Coder Perfect

[closed] WCF vs. ASP.NET Web API


I’ve been attempting to grasp the concepts of WCF for a few months now, and I’ve recently constructed my first WCF service application.

I’ve had a lot of trouble understanding all of the settings in the config file. I’m not sure about the environment, but it appears that you can accomplish incredible things with it.

Microsoft has released a new item called ASP.NET Web API, which I learned about the other day.

It’s a RESTful framework, and it’s really simple to use and implement.

Now I’m attempting to figure out what the major differences are between the two frameworks and whether or not I should try to convert my old WCF service application to use the new API.

Could someone perhaps explain the distinctions and applications of each?

Asked by LeftyX

Solution #1

For SOAP, we utilize WCF, and for REST, we use Web API. I wish the Web API also supported SOAP. We are not making use of WCF’s advanced features. The following is a comparison from MSDN:

Answered by Manish Jain

Solution #2

The new ASP.NET Web API is a continuation of the previous WCF Web API project (although some of the concepts have changed).

WCF was established with the intention of enabling SOAP-based services. ASP.NET Web API is a suitable alternative for basic RESTful or RPCish applications (think jQuery clients).

Answered by marcind

Solution #3 Web API is all about HTTP and REST-based GET,POST,PUT,DELETE with the well-known MVC programming style and JSON returnable; web API is for all light-weight processes and pure HTTP-based components. If you use WCF for even the simplest single web service, it will come with all the extra baggage. WebApi always meets the need for a light-weight, simple solution for ajax or dynamic calls. This works in tandem with MVC and complements it nicely.

Listen to the podcast here: For additional details, listen to Scott Hanselman’s Hanselminutes Podcast 264 – This is not your father’s WCF – All about the WebAPI with Glenn Block.

Answered by Naveen Vijay

Solution #4

WCF should be used in the following scenarios:

The WEB API framework is used to create RESTful/HTTP services.

Many clients, such as browsers and HTML5, do not understand SOAP, hence WEB APIs offer an excellent alternative.

The HTTP services header describes how to secure the service, how to cache the information, and the kind of message body, which can be any type of content other than XML as with SOAP services.

Answered by Kris

Solution #5

Since I’ve been using both, I’ve seen a lot of differences between WCF and Web API. Because both technology stacks work well in different contexts, it’s impossible to declare which is superior; it all depends on the configuration and scenario.

Properties              ASP.Net Web API                         WCF
End point (mainly)      Http based                              SOAP based
Service Type            Front End                               Back-end
Support                 caching, compression, versioning        No
Framework                                      WCF
Orientation             Resource Oriented                       Service Oriented
Transports              http                                    http, tcp, MSMQ, Named pipe
Message pattern         Request reply                           request Reply, one way, duplex
Configuration overhead  Less                                    Much
Security                lesser than WCF (web standard security) Very high (WS-I standard)
Hosting                 IIS                                     IIS, Windows Service, Self hosting
Performance             Fast                                    A bit slower than Web API
In use from             .NET 4.0                                .NET 3.5

Note: The information is not simply my opinion; it was gathered from other official websites as well.

Answered by Rajput

Post is based on