Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF vs ASP.NET Web API [closed]

I've spent a few months trying to grasp the concepts behind WCF and recently I've developed my first WCF service application.

I've struggled quite a bit to understand all the settings in the config file.
I am not convinced about the environment but it seems that you can do amazing stuff with it.

The other day I've found out that Microsoft has come out with a new thing called ASP.NET Web API.

For what I can read it's a RESTful framework, very easy to use and implement.

Now, I am trying to figure out what are the main differences between the 2 frameworks and if I should try and convert my old WCF service application with the new API.

Could someone, please, help me to understand the differences and usage of each?

like image 638
LeftyX Avatar asked Feb 19 '12 11:02

LeftyX


People also ask

Does ASP Net Web API replace the WCF?

The programming model of ASP.NET Web API resembles ASP.NET MVC in being simple, instead of requiring you to define interfaces, create implementation classes, and decorate them with several attributes. However, the ASP.NET Web API is not supposed to replace WCF anymore.

Which is better WCF or Web API?

WEB API is a better choice for simpler, light weight services. 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.

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

KEY DIFFERENCEWCF is used for developing SOAP-based services whereas Web API is used for both SOAP-based and RESTful services. WCF does not offer any support for MVC features whereas Web API supports MVC features. WCF supports HTTP, UDP, and custom transport protocol whereas Web API supports only HTTP protocol.

Which is more secure WCF or Web API?

WCF service provides us high level security framework which provide enterprise level security. It uses WS-I standard to provide secure service. But Web API uses web standard security such as basic authentication, token authentication and for more complex such as OAuth; Web API provides more flexibility.


2 Answers

For us, WCF is used for SOAP and Web API for REST. I wish Web API supported SOAP too. We are not using advanced features of WCF. Here is comparison from MSDN:

enter image description here

like image 150
Manish Jain Avatar answered Sep 28 '22 03:09

Manish Jain


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 originally created to enable SOAP-based services. For simpler RESTful or RPCish services (think clients like jQuery) ASP.NET Web API should be good choice.

like image 43
marcind Avatar answered Sep 28 '22 03:09

marcind