none
Asp.net web api - route based approach not working for heirarchical routes for POST methods RRS feed

  • Question

  • Hi, 

         We are implementing attribute based routing approach in our project. It seemed to work well initially with couple of controllers but once we started creating routes based on the hierarchy, POST methods are not working due to ambiguity.   Below are sample routes present on different controllers that would explain the issue.

    In Customers controller, route prefix is RoutePrefix("customers") and for POST method, attribute is Route("").

    Lets say, in orders controller, route prefix is  RoutePrefix("customers/orders") and for POST method, attribute is Route("").

    When a request is made to create an order with "http://localhost/api/customers/orders" , it is throwing the following error.

    Multiple controller types were found that match the URL. This can happen if attribute routes on multiple controllers match the requested URL. 

    Any help would be appreciated.

    Thanks,

    sveerap

    Monday, September 22, 2014 3:08 PM

Answers

  • Hi,

    It seems to be web API issue. So I suggest that you post it in asp.net Api forum where you can get better answers.

    http://forums.asp.net/1246.aspx/1?Web+API


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Pengzhen Song Tuesday, October 7, 2014 2:46 AM
    Tuesday, September 23, 2014 8:26 AM