Can a WCF ServiceRoute Route Prefix contain a path value?
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 t开发者_如何学编程here a better way to represent this instead of having to do "APIV2" ? I am using .Net 4.0
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)));
精彩评论