不多说,直接上教程!

  在 .NET 项目中集成 SwaggerUI(2018.9.30)

2. 修改生成设置

  在 .NET 项目中集成 SwaggerUI(2018.9.30)

3. 修改SwaggerConfig文件

  (1)去除注释

  c.IncludeXmlComments(GetXmlCommentsPath());

    如图:

    在 .NET 项目中集成 SwaggerUI(2018.9.30)

  (2)添加方法

      private static string GetXmlCommentsPath()
        {
            return String.Format(@"{0}\bin\xxxxxxxxxxx.XML", System.AppDomain.CurrentDomain.BaseDirectory);    //将里面的“xxx……xxx”替换成你的(第2步中的那个)
        }

4. 修改SwaggetNet文件

  如图,注释掉这两行:

  在 .NET 项目中集成 SwaggerUI(2018.9.30)

5. 启动项目打开地址即可看到结果

  http://localhost:1254/swagger/ui/index

  在 .NET 项目中集成 SwaggerUI(2018.9.30)

结语:

  此教程是本人亲自在 VS2017 中实验成功的,如果实践过程中遇到任何问题,还是自行百度吧。

  最后,附上一些别人的教程:

    https://www.cnblogs.com/youngh/p/5462537.html

    https://blog.csdn.net/small_kidy/article/details/81384177

    https://www.cnblogs.com/tdws/p/6103289.html

    https://www.cnblogs.com/dukang1991/p/5627673.html

    https://www.cnblogs.com/SzeCheng/p/4990079.html

    https://www.cnblogs.com/Rexcnblog/p/6420425.html

相关文章:

  • 2021-09-07
  • 2022-03-07
  • 2021-04-12
  • 2021-11-22
  • 2021-12-06
  • 2021-04-10
  • 2022-12-23
猜你喜欢
  • 2021-05-23
  • 2021-06-24
  • 2022-12-23
  • 2022-01-25
  • 2021-06-21
  • 2021-10-22
  • 2022-12-23
相关资源
相似解决方案