Search code examples
.netrestbasic-authentication

REST Framework for .NET 4.0


I am looking for a simple .NET REST Framework to write a simple web service with. The web service will be consumed by a Blackberry application, so my requirements aren't too strict hopefully:

  • Supports custom Basic Authentication (against a database of users)
  • Supports GET and POST.
  • Supports both JSON and XML. (XML is something I am not fussed about, so it's not mandatory)
  • Supports custom serialization of objects (I have some currently existing POCOs, which are decorated with DataMember attributes, so it would be good to keep using those classes)
  • Must be simple!
  • Preferably supports .NET 4.0. (I am not sure if it is possible to run class libraries compiled against .NET 3.5 on 4.0, but if it is, 3.5 would certainly do)
  • Runs on IIS6.

Of those, the basic authentication one is the major requirement.

I prototyped up a web service using the WCF REST Starter Kit, and it was pretty simple to get up and running, but it's all gone a bit oddly pear-shaped to be honest. Plus, it was only a prototype, and with the starter kit not being developed any more, it would probably be a good idea to re-implement it.

Would something like OpenRasta do the job?


Solution

  • I would definitely give WCF HTTP a shot (it's the latest bits from the WCF team and replaces the old hack-y REST Starter Kit). You can download it from Codeplex at:

    WCF Community Site - WCF HTTP

    If that doesn't work for you, you could always fall back to ASP.NET MVC and simply return JSON objects from your Action Methods.