美文网首页
SWAGGER UI 安装

SWAGGER UI 安装

作者: hptnt | 来源:发表于2017-01-03 22:01 被阅读0次

1.安装4.2版本 PM下安装:Install-Package Swashbuckle -Version 4.2.0

2.更新 swaggerconfig

using System.Web.Http;

using WebApi;

using WebActivatorEx;

using Swashbuckle.Application;

[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")]

namespace WebApi

{

public class SwaggerConfig

{

public static void Register()

{

Swashbuckle.Bootstrapper.Init(GlobalConfiguration.Configuration);

// NOTE: If you want to customize the generated swagger or UI, use SwaggerSpecConfig and/or SwaggerUiConfig here ...

SwaggerSpecConfig.Customize(c =>

{

c.IncludeXmlComments(GetXmlCommentsPath());

});

}

protected static string GetXmlCommentsPath()

{

return System.String.Format(@"{0}\bin\WebApi.XML", System.AppDomain.CurrentDomain.BaseDirectory);

}

}

}

相关文章

网友评论

      本文标题:SWAGGER UI 安装

      本文链接:https://www.haomeiwen.com/subject/mcgnvttx.html