I'm migrating a project to ASP.NET Core 2.0, but I'm not able to use the following routes.
Error message.
An unhandled exception occurred while processing the request.
AmbiguousActionException: Multiple actions matched. The following actions matched route data and had all constraints satisfied:
ASP.Net WebAPI2
[Route("api/[controller]")]
public class SalesController : Controller
{
// api/sales/1 -> funciona
[HttpGet]
public HttpResponseMessage Get(int id)
{
// Logic
}
// api/sales?page=1&pageSize-20 -> funciona
[HttpGet]
public HttpResponseMessage Get([FromUri] PaginationHelper pagination)
{
// Logic
}
// api/sales?me -> funciona
[ActionName("Get")]
public HttpResponseMessage GetMe(bool? me)
{
// Logic
}
}
ASP.Net Core 2.0
[Route("api/[controller]")]
public class SalesController : Controller
{
// api/sales/1 -> funciona
[HttpGet("{id:int}")]
public IActionResult Get(int id)
{
// Logic
}
// api/sales?page=1&pageSize-20 -> não funciona
[HttpGet]
public IActionResult Get([FromQuery] PaginationHelper pagination)
{
// Logic
}
// api/sales?me=false -> não funciona
[HttpGet]
public IActionResult GetMe(bool me)
{
// Logic
}
}