3 回答
TA贡献1775条经验 获得超11个赞
卸载软件包
Swashbuckle.AspNetCore.Examples
应该解决这个问题。新包是(还没试过)-
Swashbuckle.AspNetCore.Filters
(更新) 新包运行良好
TA贡献1829条经验 获得超13个赞
这对我们有用,同时升级到 .netcore 3.0:
1) 安装包 Swashbuckle.AspNetCore -Version 5.0.0-rc4
2)将代码更改为
public void ConfigureServices(IServiceCollection services)
{
...
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "WebAPI", Version = "v1" });
});
...
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env,ILoggerFactory loggerFactory)
{
...
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.RoutePrefix = "swagger/ui";
c.SwaggerEndpoint("/swagger/v1/swagger.json", "WebAPI(v1)");
});
...
}
基本上,以下示例位于https://github.com/domaindrivendev/Swashbuckle.AspNetCore/releases/tag/v5.0.0-rc4
- 3 回答
- 0 关注
- 212 浏览
添加回答
举报