asp.net core3.1 实战开发(webapi接口文档可视化工具swagger的使用)

首先控制台安装 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
 }
发布了171 篇原创文章 · 获赞 138 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_41181778/article/details/104031087
今日推荐