Swagger-Web Api Documentation(Bootstrapper is missing in Swashbuckle)

女生的网名这么多〃 提交于 2019-12-23 08:45:13

问题


I am trying to use swagger for my web api documentation, For that i have installed Swashbuckle from nuget packages but i am unable to get the Bootstrapper package in the swaggerconfig.cs class. so is there any other alternative to get the Bootstrapper package in the swaggerconfig.cs class. Please help me out. Thank you.


回答1:


If your service is hosted in IIS, you can start exposing Swagger docs and a corresponding swagger-ui by simply installing the following Nuget package:

Install-Package Swashbuckle

This will add a reference to Swashbuckle.Core and also install a bootstrapper automatically

https://github.com/domaindrivendev/Swashbuckle

Thanks.




回答2:


If Swashbuckle.Bootstrapper.Init(config); is missing. I used an older version of Swashbuckle 4.1.0 it worked for me.




回答3:


I have published a tutorial and code here in case you want to have a look




回答4:


In my case I solved it by adding reference via WebApiConfig

public static class WebApiConfig
{

    public static void Register(HttpConfiguration config)
    {
        config.MapHttpAttributeRoutes();
        config.EnableSwagger(c =>
        {
            c.SingleApiVersion("v1", "WebAPI");
        }).EnableSwaggerUi();
    }
}



回答5:


It works with Swashbuckle >= 5.6.0

//namespace
using Swashbuckle.Application;

var config = new HttpConfiguration();
config.EnableSwagger(c => c.SingleApiVersion("v1", "A title for your API")).EnableSwaggerUi();


来源:https://stackoverflow.com/questions/29430633/swagger-web-api-documentationbootstrapper-is-missing-in-swashbuckle

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!