.net core 配置SwaggerUi
作者:互联网
public void ConfigureServices(IServiceCollection services)
{
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "tttttt", Version = "v1" });
c.AddServer(new OpenApiServer()
{
Url = "",
Description = "tttttt"
});
c.CustomOperationIds(apiDesc =>
{
var controllerAction = apiDesc.ActionDescriptor as Microsoft.AspNetCore.Mvc.Controllers.ControllerActionDescriptor;
return controllerAction.ControllerName + "-" + controllerAction.ActionName;
});
//var filePath = Path.Combine(AppContext.BaseDirectory, "tttttt.xml");
//c.IncludeXmlComments(filePath, true);
});
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
}
标签:core,SwaggerUi,app,apiDesc,controllerAction,var,new,net,tttttt 来源: https://www.cnblogs.com/hzhs/p/16148523.html