Bernie Cook's Blog

Azure, C#, .NET, Architecture & Related Tech News

Web API is the New WCF

1 Comment

Mads Kristensen is a Program Manager at Microsoft and during his Tech Days 2012 talk on “What’s new in ASP.NET 4.5 + Visual Studio 11” he made a statement that “Web API is, kind of, the new WCF” – it’s about an hour in if you want the exact spot. Putting the “kind of” part to the side for the moment, this is something of interest as two key questions I ask myself, out of many that I consider when designing a new Microsoft solution, are (1) have I identified the right technologies, i.e. MVC, SQL, Azure, etc. and (2) what type of commitment is Microsoft making to the technologies I’ve chosen. I am lucky to be managing several Azure solutions, some of which I’m reworking with regards to how I expose services over HTTP, and I find it very reassuring to know where Microsoft are heading on this particular topic and I’m not going to make a decision that I regret in the medium-term because I picked the wrong framework.

Related to this, on the matter of technology choices, approximately 90% of developers are still building Web Form solutions. Microsoft know this but they’re banking on MVC, pushing it out to developers and architects wherever possible. So, by the same token as the ASP.NET Web API choice regarding HTTP services, if I’m starting a new solution I’m definitely going to think seriously about choosing MVC over Web Forms, or in this case ASP.NET Web API over WCF.

A few days after Mads announcment Scott Gu posted a blog titled “ASP.NET Web API (Part 1)“, followed a few days after by Scott Hanselman’s blog on “One ASP.NET – Making JSON Web APIs with ASP.NET MVC 4 Beta and ASP.NET Web API“. Both of these add further support to Mads point and do a great job of clarifying that point further in this posts. I’ve taken the following image from Scott Hanselman’s blog post (previously noted) as I think it clearly illustrates a number of points made above.

(Diagram taken from Scott Hanselman’s blog)

ASP.NET Web API Features

These features are taken from a post on the WCF CodePlex website, they give you an idea of how broad the ASP.NET Web API feature set is:

  • Modern HTTP programming model
  • Full support for ASP.NET Routing
  • Content negotiation and custom formatters
  • Model binding and validation
  • Filters
  • Query composition
  • Easy to unit test
  • Improved Inversion of Control (IoC) via DependencyResolver
  • Code-based configuration
  • Self-host

ASP.NET Team Merged with WCF Team

Officially, in the Microsoft camp, you’ll see Web API referred to as ASP.NET Web API. This is because they’ve merged the ASP.NET team with the WCF team. In addition to this the ASP.NET Web API has shipped with the ASP.NET MVC 4 Beta. Microsoft want an integrated web API framework which is music to my ears.

Final Note

This article really only scratches the surface of what Web API is all about. There is a lot more reading to be done if you’re really interested to know more, or get knee deep in the coding side of it.

Hopefully those reading this post will find it of some benefit when considering how they’ll be addressing future HTTP-based services requirements.

Further Reading

Author: Bernie

I currently live and work in the UK, just outside of London. I've been working in IT for 15+ years and in that time have solved many technical problems via blogs, forums, tutorials etc. and feel like I should be giving something back. This blog post is my way of contributing and I hope it proves just as useful to others as their contributions have to me.

One thought on “Web API is the New WCF

  1. This is a very nice post. I haven’t explored MVC4 / ASP.NET 4.5 yet, but i cannot wait to! 😛

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s