当前位置:网站首页>.NET Core Swagger配置
.NET Core Swagger配置
2022-04-21 15:50:00 【程序007】
Startup.cs 文件下
public void ConfigureServices(IServiceCollection services)
{
// 引用
//swashbuckle.aspnetcore ge
#region 第一步
services.AddControllersWithViews();
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "My API", Version = "v1" });
});
#endregion
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
#region 第二步
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
c.InjectJavascript( "SwgUiChina.js");
});
#endregion
}
访问方式:http://localhost:38632/swagger

怎么转中文 还没有弄。。
版权声明
本文为[程序007]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_36664772/article/details/119950690
边栏推荐
- 回调函数
- C语言进阶第41式:内存操作经典问题分析一
- 徽商期货公司开户是否可靠?交易安全吗?
- AnalyticDB PostgreSQL新版云原生让用户专注于业务,实现怎样的体验升级?
- Understand the new economic model of platofarm and its ecological progress
- Ji Geng 42 / 90
- Universal navigation: a concise and practical comprehensive navigation website
- Back to basics, multi-party security computing should return to the original consideration of "security"
- Why are you so tired to be a programmer?
- abaqus 根据坐标施加载荷- Analytical Field 载荷映射
猜你喜欢

LeetCode 203、移除链表元素

「查缺补漏」,DDD 核心概念梳理

Chapter 7 class

Avril 2022 classement de la base de données de la Chine: la brise printanière se réchauffe et les scores rebondissent en avril

AcWing 1854. Promotion count (Analog)

LeetCode 141、环形链表

Back to basics, multi-party security computing should return to the original consideration of "security"

MySQL数据库基础操作-----(基础增删查改)

全国降雨侵蚀力因子R值

Emlparse: an ultra lightweight tool for batch parsing EML format e-mail
随机推荐
注册登录程序1
Easy Language cef3 get request returned source
Detailed explanation of swap automatic arbitrage robot ecosystem development mode
Avril 2022 classement de la base de données de la Chine: la brise printanière se réchauffe et les scores rebondissent en avril
Spark comprehensive exercise - Analysis of film scoring data
Red team technology - parent process camouflage (mitre att & CK framework: t1134)
Latex common formula query
干货 | 解决 App 自动化测试的常见痛点(弹框及首页启动加载完成判断处理)
MySQL8. 0 correct password change posture
Universal navigation: a concise and practical comprehensive navigation website
MySQL-IF-THEN-ELSE语句
LeetCode 566、重塑矩阵
AcWing 1812. 方形牧场(枚举)
How can transformer break into the CV world and kill CNN?
C语言进阶第44式:函数参数的秘密(上)
AcWing 1866. Fence painting (section crossing)
Xiaobai learns MySQL - some differences in creating users in different versions
Ji Geng 57 / 90
Loading and unloading of embedded driver module
C语言进阶第42式:内存操作经典问题分析二