WCF Service or Web API

10,443

Solution 1

If you intend to do RESTful development then you will definitely want to use the ASP.Net Web Api (which was originally called WCF Web Api and created with the goal of "Making REST a first class citizen in .NET".

Another thing to consider is that the WCF REST Starter kit is no longer supported.

Note that using Web Api doesn't mean you have to use ASP.Net MVC or IIS even as it can be self hosted.

For handling operations which are non-CRUD in nature I'd recommend Googling "REST non-CRUD". I found this blog post RESTful URLs for non-CRUD operations (and particularly the comments interesting). If you decide you NEED to have RPC calls then those may have to be done with WCF. That said since WCF REST is being killed off I'm not sure what the best solution is going to be. Having both is probably the best answer but at the same time it's not necessarily a good answer.

Another alternative would be a WCF OData Service but I'm not sure if that gets any support from an iPhone.

One last point to make (that can be deleted in the future as this is time sensitive)

Microsoft has provided a Go Live license with the beta which means that it is supported by Microsoft and you shouldn't have any problems upgrading to the file RTM.

Solution 2

Service Stack also looks like an option.

Demos, overview, examples is available here.

Solution 3

There's no right answer here. You can certainly do fairly well with a WCF RESTful service. Or you could use ASP.NET MVC. Both are perfectly valid, and both have strengths and weaknesses.

Ultimately, I'd suggest you go with whatever feels the most maintainable to you.

I would like to note that MVC 4 is in beta, so watch out for bugs and don't go live until it's out of beta.

Solution 4

Since you are going to create an ASP.NET MVC web site, it would be quite comfortable to use ASP.NET Web API also because programming model is very similar and those solutions are more or less integrated with each other.

Solution 5

I would be inlclined to look at what has the best support on all platforms that you are going to use, I suspect the iPhone app may end up driving your choices.

If it was pure .net I would still tend to lean toweards a SOAP service - it is not considered cool these days but it generally will do what you need on most platforms without having to roll custom solutions.

EDIT

ASP.NET Web API means that .NET now provides a great framework for developing a restful API, I revise my answer to say that I would now lean towards this - progress is great!

Share:
10,443
Dan Ellis
Author by

Dan Ellis

Updated on June 27, 2022

Comments

  • Dan Ellis
    Dan Ellis almost 2 years

    I'm going to be working on a project that involves a number of elements:

    • ASP.NET MVC website
    • C# console application
    • iPhone App

    To get all these separate applications talking to the database, my immediate thought was to use a WCF Service.

    However, I now need to add an API to the site to allow third parties to select, insert and update records from their own applications.

    In my mind, I would just create a separate RESTful service endpoint on my WCF Service which would be locked down using authentication and would only give access to certain methods.

    However, I've been reading today about the Web API feature in MVC 4 which is meant to be the latest thing for RESTful APIs?

    Should I be going along the line of using the Web API? or because my other applications need a web service, should I stick with a WCF Service?