views:

37

answers:

1

Currently I use this:

RouteTable.Routes.Add(new ServiceRoute("API", new WebServiceHostFactory(),typeof(MySite.Web.MyServiceV1)));

To make this url point to the MyServiceV1.SVC MySite.com/API


I want to use a Prefix which contains a / in it but it doesn't seem to work.

RouteTable.Routes.Add(new ServiceRoute("API/V2", new WebServiceHostFactory(),typeof(MySite.Web.MyServiceV2)));

Is there a better way to represent this instead of having to do "APIV2" ? I am using .Net 4.0

+1  A: 

I totally forgot that the order you register routes mattered. This works:

RouteTable.Routes.Add(new ServiceRoute("API/V2/", new WebServiceHostFactory(),typeof(MySite.Web.MyServiceV2)))

RouteTable.Routes.Add(new ServiceRoute("API/", new WebServiceHostFactory(),typeof(MySite.Web.MyServiceV1)));
Vyrotek