WCF Web API vs ASP.NET MVC JSON web services

adrin picture adrin · May 1, 2011 · Viewed 10.8k times · Source

What is the advantage of using new WCF Web API over ASP.NET MVC 3 to expose a lightweight JSON Web service layer? I like Web API in many ways, but the drawback is that it doesnt work on mono, while MVC 3 does. What are the major differences between the two approaches?

Answer

Darrel Miller picture Darrel Miller · May 1, 2011

It is recognized by Microsoft, that there is some overlap between the two products. However, they do have a different focus:

  • If you are building a web site that consumes JSON from your web service then MVC is probably the best choice.

  • If you are building an API intended to be consumed by a variety of third party clients then WCF Web API is the best choice.

My own personal reasons include the fact that with WCF Web API means I can self-host in a Windows service, and I can avoid ASP.NET, web.config and Cassini :-)