ASP.NET Web API Swagger(Swashbuckle)重复的OperationId [英] ASP.NET Web API Swagger (Swashbuckle) Duplicate OperationId

查看:103
本文介绍了ASP.NET Web API Swagger(Swashbuckle)重复的OperationId的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个如下所示的Web api控制器.在大张旗鼓的输出中,我有下面的图像当我想在另一个控制台应用程序中使用它时,它显示以下错误

请注意,我已按照教程因此,API更改为以下Swagger UI端点当我在控制台应用程序中使用此Swagger时,我得到了以下OperationId我现在可以像下面这样打电话(只是一个例子)

I have a web api controller like below. In swagger output I am having the below image And when I want to consume it in my another console app, it is showing the below error

Note I have followed the tutorial Customize Swashbuckle-generated API definitions but still getting the same error. Any idea?

解决方案

I must need to add the Route Attribute on top of the Action methods. Like below: So, the API changed into below Swagger UI endpoints And when I consumed this Swagger in my console app, the below OperationId I got And I can now call like below (just an example)

这篇关于ASP.NET Web API Swagger(Swashbuckle)重复的OperationId的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆