小编Ven*_*nky的帖子

如何在 ASP.NET Web Api 中设置 swagger basePath?

我为 ASP.NET Web 应用程序启用了 swagger 文档。如何设置basePath?

GlobalConfiguration.Configuration .EnableSwagger(c => { 
    c.SingleApiVersion("v1", "MyApi") .Description("This is my API."); 
    c.IncludeXmlComments($@"{AppDomain.CurrentDomain.BaseDirectory}\bin\MyApi.XML");
}) .EnableSwaggerUi(c => {});
Run Code Online (Sandbox Code Playgroud)

目前生成的API说明如下:

"swagger": "2.0",
"host": "localhost:8080",
"basePath": "/",
Run Code Online (Sandbox Code Playgroud)

我想把它改成:

"swagger": "2.0",
"host": "localhost:8080",
"basePath": "/myapi",
Run Code Online (Sandbox Code Playgroud)

asp.net-web-api swagger swashbuckle

5
推荐指数
1
解决办法
4749
查看次数

标签 统计

asp.net-web-api ×1

swagger ×1

swashbuckle ×1