【发布时间】:2019-11-05 20:15:17
【问题描述】:
我关注了example,了解如何在我的 asp.net core 2.2 项目中添加 swashbuckle。
一旦我运行项目,我就会收到以下错误:
处理请求时发生未处理的异常。 NotSupportedException:HTTP 方法“GET”和路径“{id}”被操作重载 - dotnet1.Server.Controllers.UsersController.GetById (dotnet1.Server),dotnet1.Server.Controllers.ValuesController.Get (dotnet1.Server)。动作需要独特的方法/路径组合 招摇 2.0。使用 ConflictingActionsResolver 作为解决方法
不明白这里有什么问题。
【问题讨论】:
-
如果您能提供一个不需要我们查看外部链接的minimal reproducible example,那就太好了(大多数人不会这样做)。
-
查看异常类以了解应该使用的常见情况:docs.microsoft.com/en-us/dotnet/api/… 提到 get,我猜这是一个 webAPI。显然不支持您的 WebAPI 调用。如果您必须拥有一个功能(您必须实现一个 .NET 接口),但无法获得有意义的代码,则通常使用它。
-
你需要分享你的控制器代码
标签: c# .net asp.net-core .net-core swashbuckle