JQuery and JSON – To WCF or Not to WCF with .Net Service Layer

mvcnetwcf

I Recently had a discussion with a colleague of mine about the pros / cons of WCF. He mentioned about how much code is generated to support WCF, and also the overhead required. It was mentioned that a simple jQuery /Ajax post to a .aspx page (or a handler for that matter) that returns JSON would work more efficiently and takes much less code to implement. I am also aware of the new WCF Web API and feel that technology may solve the "bloated"-ness required in attaining a proxy etc… by just outputting JSON.

So when developing a relational DB (MSSQL) storage model, with a fairly complex Business Layer (C#) and Data Access Layer (EntityFW).. what's a good technology for creating a "service layer" which will spit out View Models represented in JSON, with a CQRS(Command Query..) approach in mind.. The app would use the service layer to support it's required UI, as well as provide an available subset of services (outputting JSON data) for service subscribers..

In other words an admin panel to support the admin UI, and service endpoints that return JSON to access the configurations made from the administration UI.

What are some potential technologies to use as the transport / communication layer. I'd like to use a pure RESTful approach, but am not against doing some URL rewriting with IIS.

Obviously some of the available technologies are:
WCF
WCF Web API (should this even be separate?)
Straight request / response (query string to .aspx / handler)
Would using MVC .Net solve this entire problem? maybe their single page app approach?

any suggestions / feedback from developing this type of application?

Thanks,

Best Answer

If you are on frontline .Net (4.5), I see two options really:

  • Web API (the mvc controller REST thing)
  • Wcf via SOAP

Both of these could act as a service layer in a .Net system.

You could also use Wcf over JSON (REST), but this is not a simple thing to implement and maintain.

Wcf have a high learning curve, but once you pass it, Wcf really becomes simple for most usages, especially if you are containing your client proxy creation meaningfully.

Related Topic