From 72a97fd704b6a4ffb7c729dd7499aeb1436261fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=87=E9=98=B3=20=E9=82=B9?= Date: Fri, 22 Dec 2023 17:50:27 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=9E=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E7=A6=81=E7=94=A8swagger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 24Hour/24Hour.csproj | 4 ++-- 24Hour/Program.cs | 18 +++++++----------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/24Hour/24Hour.csproj b/24Hour/24Hour.csproj index 9bde41e..8d1cbda 100644 --- a/24Hour/24Hour.csproj +++ b/24Hour/24Hour.csproj @@ -8,8 +8,8 @@ True e485308c-2f05-470b-b0a4-68f1ec2b3412 Linux - 1.0.2.7 - 1.0.2.7 + 1.0.3.1 + 1.0.3.1 diff --git a/24Hour/Program.cs b/24Hour/Program.cs index 9c6b24b..7d64b52 100644 --- a/24Hour/Program.cs +++ b/24Hour/Program.cs @@ -268,8 +268,13 @@ var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { - app.UseSwagger(); - app.UseSwaggerUI(); + app.UseSwagger();// 启用Swagger中间件 + app.UseSwaggerUI(c => + { + c.SwaggerEndpoint("/swagger/v1/swagger.json", "24小时一体机 API V1"); + c.RoutePrefix = string.Empty; + + }); } #region websockets配置 app.UseWebSockets(new WebSocketOptions @@ -293,15 +298,6 @@ app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); -#region swagger -app.UseSwagger();// 启用Swagger中间件 -app.UseSwaggerUI(c => -{ - c.SwaggerEndpoint("/swagger/v1/swagger.json", "24小时一体机 API V1"); - c.RoutePrefix = string.Empty; - -}); -#endregion app.UseCors("CorsPolicy"); app.Run();