admin管理员组文章数量:1122846
I'm implementing an OData controller in an ASP.NET Core project, and I've added a new HttpDelete endpoint to delete a person by their ID. However, when I send a DELETE request to the endpoint, I get the following error:
Microsoft.AspNetCore.Routing.Matching.AmbiguousMatchException: The request matched multiple endpoints. Matches:
AirVinyl.Controllers.PeopleController.DeletePerson (AirVinyl)
AirVinyl.Controllers.PeopleController.DeletePerson (AirVinyl)
[HttpDelete("odata/People({key})")]
public async Task<IActionResult> DeletePerson (int key)
{
var currentPersion = await _airVinylDbContext.People.FirstOrDefaultAsync(c=>c.PersonId == key);
if (currentPersion == null)
{
return NotFound(ModelState);
}
_airVinylDbContext.Remove(currentPersion);
await _airVinylDbContext.SaveChangesAsync();
return NoContent();
}
I only have this one DeletePerson method in my PeopleController.
Confirmed that my PeopleController inherits from ODataController. Cleaned and rebuilt the solution to rule out stale builds.
本文标签: cOData The request matched multiple endpoints Matches when Delete requestStack Overflow
版权声明:本文标题:c# - OData The request matched multiple endpoints. Matches when Delete request - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736303728a1931987.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论