Seems by error, I had put my config.Routes.MapHttpRoute(...) under RouteConfig.RegisterRoutes(...) instead of WebApiConfig.Register(...). But even then, the WebApi controller actions seemed to work just fine.
Does this mean that if the MVC controller and Web API controllers are in the same project and namespace, are their routes put into the same Route table?
are their routes put into the same Route table
Short answer would be yes.
They all end up in the same route table. Which also explains why you tend to put Web API routes before MVC routes and also why there can be route conflicts.
RouteConfig.RegisterRoutes(...) and WebApiConfig.Register(...) are just ways to organize and group related code together.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With