Route conflict between controller actions (ASP0023)
Key dotnet.api.action-route-conflict · Severity warning · Category api
ASP.NET Core analyzer ASP0023. Flags two controller actions with the same route and HTTP method. Requests fail with an ambiguous-match error.
Incorrect
Section titled “Incorrect”[HttpGet("{id}")]public IActionResult Get(int id) => Ok();
[HttpGet("{orderId}")]public IActionResult Load(int orderId) => Ok();Correct
Section titled “Correct”[HttpGet("{id}")]public IActionResult Get(int id) => Ok();
[HttpGet("{orderId}/lines")]public IActionResult Lines(int orderId) => Ok();