Swaggergeneratorexception:冲突方法/路径组合“ post api/v {version}/雇员”采取行动
当使用这种方法大肆宣传时,我有问题。你能帮助我吗?
[HttpPost]
[ApiVersion("1.0")]
public IActionResult SetEmployeeV1()
{
v1 ...
}
[HttpPost]
[ApiVersion("2.0")]
public IActionResult SetEmployeeV2()
{
v2 ...
}
I have problem when run swagger with this methods. Can you help me?
[HttpPost]
[ApiVersion("1.0")]
public IActionResult SetEmployeeV1()
{
v1 ...
}
[HttpPost]
[ApiVersion("2.0")]
public IActionResult SetEmployeeV2()
{
v2 ...
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我创建2个控制器来表示不同版本。
这是版本。
这是版本2:
现在我可以在浏览器中成功称呼它们,但是我不能让API迅速显示。 ,我需要修改程序。
因此 //i.sstatic.net/oy2va.png“ alt =”在此处输入图像描述”>
I create 2 controllers to represent different versions.
This is version one.
This is version 2:
Now I can call them successfully in a browser, but I can't let the api displayed in swagger. So I need to modify Program.cs(Startup.cs in .net 5)
我遇到了相同的错误
SwaggerGenerAtoreXception:冲突方法/路径组合“补丁API/操作需要Swagger/OpenAPI 3.0的唯一方法/路径组合。将ConcustingSignActionSresolver用作解决方法
。您可以得到实际错误通过以下
例如
。 。
I was getting the same error
SwaggerGeneratorException: Conflicting method/path combination "PATCH api/ Actions require a unique method/path combination for Swagger/OpenAPI 3.0. Use ConflictingActionsResolver as a workaround
. You can get the actual error by going to your Swagger link like below.https://localhost:{yourport}/swagger/v1/swagger.json
This happens when you have the same route for multiple APIs. For example:-
All you have to do is to change that to specific routes as
[HttpPatch("Do1")]
and[HttpPatch("Do2")]
.解决方案之一是针对.net 6+,在
program.cs
One of the solution would be For .NET 6+, configure the Swagger Generation in
Program.cs