.Netcore Swagger - 解决外部库导致的“Actions require an explicit HttpMethod binding for Swagger 2.0”
现象:
项目中导入Ocelot后,swagger页面无法正常显示,查看异常发现 Ocelot.Raft.RaftController 中的 Action 配置不完全,swagger扫描时不能正确生成 swagger.json
解决方法:
在扫描中隐藏Ocelot的controller,避免被swagger生成文档
创建ApiExplorerIgnores
public class ApiExplorerIgnores : IActionModelConvention
{
/// <summary>
/// Ocelot自带的Controller与swagger2.0冲突,在此排除扫描
/// </summary>
/// <param name="action"></param>
public void Apply(ActionModel action)
{
//冲突的Ocelot.Raft.RaftController
if (action.Controller.ControllerName.Equals("Raft"))
action.ApiExplorer.IsVisible = false;
//Ocelot.Cache.OutputCacheController
if (action.Controller.ControllerName.Equals("OutputCache"))
action.ApiExplorer.IsVisible = false;
}
}
setup.cs中添加
services.AddMvc(c => c.Conventions.Add(new ApiExplorerIgnores()));
.Netcore Swagger - 解决外部库导致的“Actions require an explicit HttpMethod binding for Swagger 2.0”的更多相关文章
- Ambiguous HTTP method Actions require an explicit HttpMethod binding for Swagger 2.0
异常内容 NotSupportedException: Ambiguous HTTP method for action . Actions require an explicit HttpMetho ...
- .Net Core Swagger:Actions require an explicit HttpMethod binding for Swagger 2.0
添加完Swagger包引用后运行报错:Actions require an explicit HttpMethod binding for Swagger 2.0 第一时间想到了父类控制器 没有添加 ...
- Ambiguous HTTP method Actions require an explicit HttpMethod binding for Swagger 2.0 异常
网上看了很多关于此异常的解决方案,但是大多数都是不能用的,今天把正确的解决方案记录下来,以帮助需要的人 问题:有些接口没有设置HttpPost或HttpGet,非接口设置访问权限为private,控制 ...
- Actions require unique method/path combination for Swagger
原文:Actions require unique method/path combination for Swagger services.AddSwaggerGen (c => { c.Re ...
- [Cocos2d-x]解决Android平台ndk-build时不自动删除外部库
参考链接: http://blog.chinaunix.net/uid-26009923-id-3430612.html http://hi.baidu.com/hpyfei/item/52a2b21 ...
- ios开发中用过的一些外部库总结 cocoapods list
下面几个库是在之前的一个ios app开发中使用过的一些外部库: 1. zbar :2. shakebox :3. processbar :4. tableviewcontroller :新版的sta ...
- linux下编译ffmpeg 引入外部库x264
Found no assembler Minimum version is nasm-2.13 If you really want to compile without asm, configure ...
- GNU编译器学习 --> 如何链接外部库【Linking with external libraries】
库也就是我们常说的library,一个库是若干个已经编译过的目标文件(.obj)的集合,它可以被链接到程序里.那么我们最常见的使用就是,我们在编程时会调用一些函数,这些函数别人已经写好了,它就放在库里 ...
- [转帖]Redis持久化--Redis宕机或者出现意外删库导致数据丢失--解决方案
Redis持久化--Redis宕机或者出现意外删库导致数据丢失--解决方案 https://www.cnblogs.com/xlecho/p/11834011.html echo编辑整理,欢迎转载,转 ...
随机推荐
- d3.js 教程 模仿echarts折线图
今天我们来仿echarts折线图,这个图在echarts是折线图堆叠,但是我用d3改造成了普通的折线图,只为了大家学习(其实在简单的写一个布局就可以).废话不多说商行代码. 1 制作 Line 类 c ...
- SpringBoot之【mybatisplus】代码生成器
1.概述. AutoGenerator 是 MyBatis-Plus 的代码生成器,通过 AutoGenerator 可以快速生成 Entity.Mapper.Mapper XML.Service.C ...
- Scrum Meeting - 第六周【Alpha阶段】
每日任务内容: 本次会议为第六次Scrum Meeting会议 本次会议项目经理召开时间为20:00,在北区男生宿舍楼召开,召开时长约15分钟,探讨了本周选课网站编写的后续工作. 小组成员 本周任务 ...
- linux 删除.svn文件
linux删除当前目录及其子目录下的.svn文件,linux下删除全部的.svn文件 find . -name "*.svn" -type d -print -exec rm -r ...
- 第二个视频作品《[SpringCloudAlibaba]微服务之注册中心nacos》上线了
1.场景描述 第二个视频作品出炉了,<[SpringCloudAlibaba]微服务之注册中心nacos>上线了,有需要的朋友可以直接点击链接观看.(如需购买,请通过本文链接购买) 2. ...
- DOMContentLoaded vs jQuery.ready vs onload, How To Decide When Your Code Should Run
At a Glance Script tags have access to any element which appears before them in the HTML. jQuery.rea ...
- C语言 复习函数
什么是函数呢? 首先函数是在完成特定任务的程序代码中,拥有自己独立的单元. 举个例子 “你可以拿本书吗?” ”你可以拿本语文书吗?“ “你可以拿苹果吗?”..... 如果要是放到程序里面估计要重复很多 ...
- 如何通过QT designer设置不让窗口最大化
最近使用QT写一个小窗口的程序,窗口通过QT designer制作之后,运行时可以最大化操作,且最大化之后界面上控件也不会随窗口变化而变化,但由于人都比较懒,直接在QT designer设置窗口属性时 ...
- 《HTTPS权威指南》读书笔记——PKI
互联网公钥基础设施 基于可信的第三方机构(CA,certification authority)实现不同成员在不见面的情况下进行安全通信 订阅人 需要证书来提供安全服务的团体 登记机构(RA) 完成证 ...
- 计算机网络基础笔记 运输层协议UDP/TCP
目录 UDP 首部结构 主要特点 TCP 首部结构 主要特点 TCP 可靠性实现 停止等待ARQ协议 连续ARQ协议&滑动窗口协议 拥塞控制 TCP 运输连接管理 连接建立:三次握手 连接释放 ...