From 966d1fe6077c885db064fcea98bb48cbccb464d6 Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期一, 14 十月 2024 17:23:02 +0800 Subject: [PATCH] WCS --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs" index d9ee764..90c4c55 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs" @@ -17,6 +17,8 @@ using WIDESEA_WMSServer.Filter; using WIDESEA_Core.Authorization; using WIDESEA_Core.Core; +using Swashbuckle.AspNetCore.SwaggerGen; +using Microsoft.OpenApi.Models; var builder = WebApplication.CreateBuilder(args); @@ -96,6 +98,17 @@ builder.Services.Replace(ServiceDescriptor.Transient<IControllerActivator, ServiceBasedControllerActivator>()); Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); +builder.Services.AddSwaggerGen(c => +{ + // 启用XML注解 + var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; + var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); + if (File.Exists(xmlPath)) + { + c.IncludeXmlComments(xmlPath); + } +}); + var app = builder.Build(); -- Gitblit v1.9.3