问题
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