报错信息:
Microsoft.AspNetCore.Routing.Matching.AmbiguousMatchException: The request matched multiple endpoints. Matches:
Api.Controllers.ProjectController.Paging (Api)
Api.Controllers.UserController.Paging (Api)
问题解析
请求匹配了多个端点,请求的后端接口路由重复了,检查后发现以下两个控制器的路由写成一样了
Api.Controllers.ProjectController.Paging (Api)
Api.Controllers.UserController.Paging (Api)
都写成了
[Route("api/user")]
[ApiController]
解决方案
知道了问题所在,解决就简单了,改一下Route就可以了
[Route("api/user")]
[Route("api/project")]