【问题标题】:Error: "AmbiguousMatchException: The request matched multiple endpoints."错误:“AmbiguousMatchException:请求匹配多个端点。”
【发布时间】:2020-02-28 08:37:34
【问题描述】:

http://localhost:56191/WebImages/index中请求页面时出现错误:

*An unhandled exception occurred while processing the request.*<br>
*AmbiguousMatchException: The request matched multiple endpoints. Matches:*

*WebApp.Controllers.WebImagesController.Index (WebApp)*<br>
*WebApp.Views.WebImagesController.Index (WebApp)*

*Microsoft.AspNetCore.Routing.Matching.DefaultEndpointSelector.ReportAmbiguity(CandidateState[] candidateState)*

会不会是因为数据库更新而跑了?:

"Scaffold-DbContext "Server=Machinexx; Database=MyDBxx; Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -force"

【问题讨论】:

  • 请告诉我们您的Controller,以便我们更好地了解问题所在。
  • 不,这与你的数据库无关,正如错误所说,你有两个同名的控制器。
  • 你的路由没有定义好,请参考this thread希望对你有帮助

标签: c# asp.net-core


【解决方案1】:

CodeCaster 是对的。我在 View 文件夹中有另一个同名的控制器,但我不知道它是如何到达那里的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-27
    • 1970-01-01
    • 2021-09-02
    • 2020-11-24
    • 2021-06-02
    相关资源
    最近更新 更多