Question: Ensure that WebAPI2 routes are matched before MVC Routes

Question

Ensure that WebAPI2 routes are matched before MVC Routes

Answers 0
Added at 2017-01-04 17:01
Tags
Question

I have a web application which uses both MVC and WebAPI2. I would like for requests to always be matched up with WebAPI2 attribute routes before matching manually configured MVC routes. I have tried calling configuration.MapHttpAttributeRoutes() before I call RouteConfig.RegisterRoutes(RouteTable.Routes) but this does not seem to work.

Is there any way to ensure the WebAPI2 routes will always have precedence?

Answers
Source Show
◀ Wstecz