NetCoreApi框架搭建(一、swagger插件使用)

1.首先用vs2017创建新的项目

2.开始引入swagger插件

右击项目=>管理NuGet程序包=>搜索Swashbuckle.AspNetCore点击安装

3.打开Startup.cs类,编辑ConfigureServices类

编辑Configure

扫描二维码关注公众号,回复: 6981416 查看本文章

4.设置swagger ui页面为启动页(找到launchSettings.json修改launchUrl值为swagger/index.html)

这时候按住Ctrl+F5运行

5.显示注释

PlatformServices需要引用nuget包Microsoft.Extensions.PlatformAbstractions

6.显示控制器的注释

 运行看看结果

 

猜你喜欢

转载自www.cnblogs.com/net16/p/11321108.html
今日推荐