Search code examples
asp.netasp.net-web-apiasp.net-routing

Difference between RouteTable.Routes and HttpConfiguration.Routes?


I am wondering why routes seem to be configurable from both the HttpConfiguration object and the RouteTable class? Clearly the two .Routes properties are not of the same type, but they seem to stay in-sync. Is there a chance they could get out-of-sync? I'm wondering though, from a Web API perspective, should RouteTable.Routes ever be used?


Solution

  • The HttpConfiguration class is specific to WebApi making it reusable outside of IIS (e.g. For self hosting). The RouteTable version is for IIS only.