Posted on

When you creating your first OData WCF Data service common tasks is to give a friendly URL instead of using filename.svc as entry point.You can archive it with URL routing feature in ASP.NET MVC.Just modify your Global.asax.cs route registration block to include following lines.

public static void RegisterRoutes(RouteCollection routes)
       {
           routes.Clear();
           var factory = new DataServiceHostFactory();
           RouteTable.Routes.Add(
               new ServiceRoute("API", factory, typeof (TestOdataService)));

It tells system to associate data service factory handler with a given URL.