1,nuget Swashbuckle.AspNetCore
2,Startup.cs 中方法: ConfigureServices
添加代码
services.AddSwaggerGen();//注册 Swagger
3,Startup.cs 中方法:Configure
添加代码
app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "API接口文档"); });