WebAPI纯净版中增加Swagger

WebAPI纯净版的基础上

  • 添加nuget包   a). Swashbuckle    b). Swagger.Net.UI

  • 取消文件SwaggerConfig.cs中 c.IncludeXmlComments(GetXmlCommentsPath());的注释
  • 并在此类中添加方法:GetXmlCommentsPath()
1 private static string GetXmlCommentsPath()
2         {
3             return string.Format(@"{0}\bin\WebApi.XML", AppDomain.CurrentDomain.BaseDirectory);
4         }

  • bin\WebApi.XML这个路径的由来:

 

  • 注释掉SwaggerNet.cs文件中的部分代码,见下图

  • 运行工程:

posted @ 2019-01-29 11:09  哎呦喂MyGod  阅读(291)  评论(0编辑  收藏  举报