DelegatingChannel - How to determine the service endpoint (or route prefix) from RequestUri.

Topics: Web Api
Jun 21, 2011 at 10:39 PM
Edited Jun 22, 2011 at 7:59 PM

How does WCF (and WebApi) map a Uri to the correct service endpoint?

Inside a custom channel, I'd like to find the associated route prefix or service Type based on the HttpRequestMessage.RequestUri.

So for instance,

RouteTable.Routes.MapServiceRoute<ManagersResource>("employees/managers", config);
RouteTable.Routes.MapServiceRoute<EmployeesResource>("employees", config);

A request comes in for http://server/employees/John

How does WCF map this to the correct endpoint.  Within the SendAsync method of a DelegatingChannel, can I easily determine the correct route prefix or service type given the RequestUri?

Much thanks in advance.

Jun 23, 2011 at 2:27 PM
Edited Jun 23, 2011 at 2:27 PM

I've posted this question on stack overflow as well. Feel free to answer there.

http://stackoverflow.com/questions/6446480/how-does-wcf-webapi-map-a-request-uri-to-the-appropriate-service-type-operation

Thanks again!