views:

170

answers:

4

Hi Guys,

I simply want to create a fairly basic REST service, so that I can expose some of the data in my asp.net/SQL server application to the outside works, like this.....

http://domain.com/api/offices - would return an xml set of office locations. http://domain.com/api/offices/15 - would return all the details of office 15.

It's all fairly standard stuff (including basic authentication) but there seem to be several ways to achieve this using Microsoft technologies and I don't really know where to start. These seem to be the options...

1) WCF

2) ASP.NET MVC

3) ADO.NET Data Services

4) Rest Starter Kit project templates?

Which of these is the easiest and most "up-to-date" solution to creating a web service?

+2  A: 

If you don't plan on adding any other endpoints in the future (like SOAP, etc.) and the Service isn't going to be consumed by a Silverlight client, I would suggest using ASP.NET MVC.

If Silverlight is involved, then use ADO.NET Data Services.

If you plan on building out a robust Service framework with multiple endpoint types, then use WCF.

Justin Niessner
Second for ASP.NET MVC. Our team used it on our last web project and were very happy with it.
Mike
I'm prepared to learn MVC from scratch if I have to but wouldn't it be easier to use something like the WCF REST starter kit?
jonhobbs
@jonhobbs Last I checked, the WCF REST starter kit wasn't perfect. There were definitely some issues with the services it produced. I've known several people successful in building RESTful services with .NET MVC.
Justin Niessner
A: 

Phil Haack did a good article on this here

Daniel Dyson
+2  A: 

There are a few alternatives, not sure if you heard of them but might as well look into them:

  • Open Rasta IT s a fairly opinionated Rest framework that lets you create web services and web sites, its a bit weird to get your head around it first but; its so light weight that makes sense to give it a go, it requires some idea on how Rest actually works (and not the .net abstraction that you might be used to) and i think it doesnt have a very strong dependency on asp.net, an obvious advantage to me is that you can encode to HTML, JSON or any format you might need, its quite interesting

  • Another option out there, (that I havent used), is Siesta, wich works on top of Asp.net mvc

Wcf configuration can get very painful very quickly...

Hope it helps

Miau
+1  A: 

ADO.NET Data Services is now WCF Data Services, and that's what I'd recommend. It's pretty easy to work with (at least for the type of services you describe). You might also want to take a look at the Open Data Protocol -- you probably don't need it, unless you're supporting non-.NET clients (PHP, Java).

TMN
I actually want to expose the data to a Java Android app, but can't I access a RESTful service using Java anyway, even if it is creates using asp.net? What would be the advantage of ODP?
jonhobbs
According to this page, WCF Data services produces OData services anyway - http://msdn.microsoft.com/en-us/data/bb931106.aspx - This is all very confusing.
jonhobbs
You can get a client ODP library from MS for Java. This would be handy if you were using Entity Framework classes or something else move involved, but if all you're doing is just snagging a simple hierarchy of name:value pairs, I doubt it'd be worth the effort.
TMN