Asp.net-mvc – RESTful services: WCF versus ASP.NET MVC

asp.net-mvcrestwcfwcf-rest

A very common approach to implementing RESTful services is by utilizing ASP.NET MVC to do so over WCF.

ASP.NET MVC has excellent RESTful support by via flexible URL routing and flexible HTTP Method mapping to controller actions.

WCF 4.0 now has excellent support for implementing RESTful service also using the same ASP.NET routing mechanism as ASP.NET MVC.

Question
What are your experiences working with either of the 2 approaches to create RESTful services and pros and cons encountered?

Best Answer

WCF services can be self-hosted. No IIS required. ASP.NET MVC is focused on delivering HTML, whereas the existing .net 4 WCF stack is focused more on XML and JSON.

The new http://wcf.codeplex.com is the next generation of REST on WCF and will be significantly more capable than the existing stack.

The new stack will be much better at supporting all different media types. It provides much better access to the underlying HTTP protocol. It will be much more testable and will make it easier to plug in reusable handlers to add standard behaviours.