Phil.Wheeler
Phil.Wheeler

Reputation: 16858

What would be the wisest choice for a new .Net RESTful web service?

I want to write my first REST web service using the .Net framework. I've seen fairly passionate comments from various people about which is best and have even found some differing comments from Microsoft.

My web service should be fairly simple: I want to expose bus timetable information. I figure the resources I will be concerned about are

What would be the most appropriate (i.e. not necessarily the easiest, most fun or your personal preference) technology to use out of WCF, ADO.NET Data Services or ASP.Net MVC?

Upvotes: 0

Views: 204

Answers (4)

Franci Penov
Franci Penov

Reputation: 76021

WCF is the Microsoft messaging bus. It aims to help with development of distributed message driven services.

WCF Data Services is an implementation of the OData protocol on top of WCF that helps with exposing your data through an automatically generated RESTful interface.

ASP.NET MVC is a framework that helps with development of web applications based on the model-view-controller pattern.

You can implement your RESTful service using any of the three technologies, however:

  • Choose WCF if you want full control over the definition of your service interface and payload.
  • Choose WCF Data Services if you need to expose your data over OData with minimum efforts around the actual service implementation.
  • Choose ASP.NET MVC if you want a simple RESTful service that is well integrated within your a web-site and shares and reuses code with it; and you don't mind the overhead of the ASP.NET pipeline.

I would personally suggest you use the WCF Data Services to implement your service, since it seems to be mostly data-driven.

Upvotes: 2

vtortola
vtortola

Reputation: 35963

You can develop your own as well, creating a http handler that handles all requests, and parsing the urls yourself. It's a little bit more difficult and time consuming, but you get more control. I'm doing one in this way, so I get the URL and I parse the diferent segments and the request stream to know which data should I push to the output stream in XML.

It it's a project you have to deliver and forget, go with WCF REST, but if it's an application for yourself or your own company or simply you want to learn and have fun seeing how everything works under the hood... let aside the happy Microsoft "everything-in-one-frameworks" and do it yourself :D

Cheers.

Upvotes: 1

ChrisLively
ChrisLively

Reputation: 88092

If you want simple, just use generic handlers (.ashx).

If you want complicated, then WCF.

Personally, I've done a couple WCF projects and quite frankly won't willingly do another one. It's a tremendous amount of code just to get the simplest things to work.

Upvotes: 5

eaglestorm
eaglestorm

Reputation: 1202

ASP.NET MVC is for web applications so not that

We currently use WCF at work and I'n not over joyed at it's design although it seems easy to use the web.config file is a pain in the arse and it is to easy to put everything in one huge service.

Haven't used ADO.Net Data Services so can't say.

Honest adivce use a Java solution instead, I only work in the Microsoft ecosystem at work and would avoid a workplace that only used Microsoft if I changed jobs.

Java is much nicer, the language and api is cleaner and there is alot more third party software for enterprise level applications.

Upvotes: -2

Related Questions