I trying to develop WCF RESTful service. I’m using VS 2010 Premium with .Net 4. I have downloaded WCF REST Starter Kit and also downloaded WCF REST templates for VS 2010 from visual studio gallery. (WCF
REST Service Template 40(CS) ). I have to install the templates from gallary becuase the templates that comes with WCF REST Starter Kit only works with VS 2008
On all the learning videos & MSDN it says use WebServiceHost2 & WebServiceHost2Factory class for RESTful services, because these classes are specifically designed for REST services and they are included in Microsoft.ServiceModel.Web.dll. Also the
examples I have seen so far uses .svc file to host the service.
So I created a project using the WCF REST Template which I have downloaded from Visual Studio gallery. But it created a service class without using .svc file and also there is no reference to Microsoft.ServiceModel.Web.dll. After little bit of digging and
goggling I found its using RouteTable class . Below is the code in global.ascx added by the template
RouteTable.Routes.Add(new ServiceRoute("Service1", new WebServiceHostFactory(), typeof(Service1)));
If you note, its not using WebServiceHost2Factory instead its using WebServiceHostFactory.
These is also new WCF Web API which says
"ServiceRoute has a known issue with that causes it to interfere with ASP.NET MVC action link generation. To work around this issue use WebApiRoute in WCF Web API Enhancements instead."
So now I’m completely confused which is the best way to develop & start WCF RESTful service and what’s the advantage of one over other. I know these approaches will work but which one is preferred approach
Again, im using VS 2010, .Net 4, IIS 7.5