Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RESTful services: WCF versus ASP.NET MVC

Tags:

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?

like image 615
Kyriacos Miltiadous Avatar asked Mar 26 '11 20:03

Kyriacos Miltiadous


People also ask

What is the difference between WCF and MVC?

WCF is an inter-process communication mechanism, which means it is used when several processes, either on the same machine or on different machines (client-server applications) need to talk to each other. MVC on the other hand, is a pattern that separates the UI from the back-end logic.

Is ASP NET MVC RESTful?

MVC is restful in nature, but it is not strictly adherent to REST and can be tailored to whatever you see fit.

What is the difference between MVC and REST API?

MVC is about how the inner side of your app works. REST is about how your app "talks" with other apps. You can combine them.

What is the difference between WCF and the Asp Net Web API service?

Use WCF to create reliable, secure web services that are accessible over a variety of transports. Use ASP.NET Web API to create HTTP-based services that are accessible from a wide variety of clients. Use ASP.NET Web API if you are creating and designing new REST-style services.


2 Answers

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.

like image 59
Darrel Miller Avatar answered Nov 18 '22 14:11

Darrel Miller


Take a look at Podcast from Scott Hanselminutes with Glenn Block where they discuss same issue and compares MVC and new WCF Web API. http://www.hanselminutes.com/default.aspx?showID=284

like image 37
Ajay Bhosale Avatar answered Nov 18 '22 15:11

Ajay Bhosale