We’re currently trying to upgrade our web services to MVC4/Web Api without breaking any existing endpoints, but we’re pretty new to the routing features. It would seem that it automatically expects you to begin a request by adding /api to the url before actual routing kicks in:
Currently, our route is “{controller}/{action}/{id}”. Notice that it is NOT prefixed with api/, however instead of requesting:
http://host:port/MyController/MyAction
we still have to request:
http://host:port/api/MyController/MyAction
but this would effectively break our endpoints. How do I remove the /api from the route?
Ok, I am answering this just because some +1’d it so I imagine this will be of use to someone. I was looking in the wrong the place. The routes were set in RouteConfig.cs, but they needed to be changed in WebApiConfig.cs. In THAT file, there WAS “api/” prepended. So I removed that and all is good.