首先控制台安装 Swashbuckle.AspNetCore -Version 版本号-rc4包
public void ConfigureServices(IServiceCollection services)
{
#region apiSettings
services.AddSwaggerGen(m => m.SwaggerDoc("v1", new OpenApiInfo { Title = "Web Shopping Mall", Version = "v1" }));
#endregion
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
#region apiSettings
app.UseSwaggerUI(m => m.SwaggerEndpoint("/swagger/v1/swagger.json", "Web Shopping Mall"));
#endregion
}