I am having issues getting Web API to work with subdomain-based routes. In short, I am getting to the right controller and method but the data token out of the subdomain is not
Thanks for reporting the issue. I used your repro at https://github.com/woloski/AspNetWebApiWithSubdomains and did some debugging.
Here is why it is happening. The HttpDomainRoute.GetRouteData
is not being called because it was wrapped by an internal class called HttpWebRoute
in Web API. When you use config.Routes.Add
method to add your custom route, instead of calling the HttpDomainRoute.GetRouteData
, it will simply call the System.Web.Routing.Route's
implementation of GetRouteData
. That is why you see the rest of parameters being mapped correctly except the tenant.
I can't think of any easy workaround on top of my head. I can file a issue at the codeplex site at http://aspnetwebstack.codeplex.com/ to track this issue.