Angularjs – reason to use WCF over asp.net MVC

angularjsasp.net-mvcn-tier-architecturewcf

If I am using knockout.js or angular.js for the presentation layer, also assume that the service layer needs to write data and read data from the database and it holds the business rules. Is there a reason why I should use WCF over asp.net MVC for the service layer? Calling an MVC controller that returns JSON data seems pretty simple, I can't think of a reason to use WCF.

Best Answer

If you are specifically targeting the web stack, ASP.NET MVC + WebApi would be the right combination on the server side.

The inherent support for JSON on both client and server makes a JSON-based API very popular. More and more public APIs from most of the providers are JSON-based or at least support JSON.

WCF may have its applicability in terms of server-to-server communications but for a web stack, I don't think it's a good fit. If you have a requirement to support multiple transport mediums, bind with protocols other than HTTP, support binary serialization for performance, complex security requirements, then WCF can help you.

Also for JSON based API, I suggest you use WebApi instead of using MVC and returning a JsonResult.