I came across this issue, and couldn't find a quick guide to is, so here I am.
I've created and ASP.NET Core API.
On one controller, i've defined 2 get methods. Each accepts different parameter, but both are Strings. This creates following issue.
Microsoft.AspNetCore.Routing.Matching.AmbiguousMatchException: The request matched multiple endpoints. Matches:
Airbnb.Controllers.ListingsAndReviewsController.GetById (Airbnb)
Airbnb.Controllers.ListingsAndReviewsController.GetByName (Airbnb)
My methods were looking like this.
[HttpGet("{id}")]
public IEnumerable<ListingsAndReviews> GetById(String id)
{
}
[HttpGet("{name}")]
public IEnumerable<ListingsAndReviews> GetByName(String name)
{
}
site.com/ListingsAndReviews/gibberish-string? Your router dont know whethergibberish-stringis a id or a name. So help it find a match, change your url template to something different for each method.