hutongqing
2024-10-25 9eeca6aa905cffea1c95d965b4790fbd20ce2275
WIDESEAWCS_Server/WIDESEAWCS_Core/Middlewares/SwaggerMiddleware.cs
@@ -24,15 +24,13 @@
            app.UseSwaggerUI(c =>
            {
                //根据版本名称倒序 遍历展示
                var apiName = AppSettings.app(new string[] { "ApiName" });
                var apiName = AppSettings.Get(new string[] { "ApiName" });
                typeof(ApiVersions).GetEnumNames().OrderByDescending(e => e).ToList().ForEach(version =>
                {
                    c.SwaggerEndpoint($"/swagger/{version}/swagger.json", $"{apiName} {version}");
                });
                //c.SwaggerEndpoint("/swagger/v1/swagger.json", "WIDESEA.Core后台Api");
                //c.SwaggerEndpoint($"https://petstore.swagger.io/v2/swagger.json", $"{apiName} pet");
                c.SwaggerEndpoint($"https://petstore.swagger.io/v2/swagger.json", $"{apiName} pet");
                // 将swagger首页,设置成我们自定义的页面,记得这个字符串的写法:{项目名.index.html}
                if (streamHtml.Invoke() == null)
@@ -43,12 +41,6 @@
                }
                c.IndexStream = streamHtml;
                c.DocExpansion(DocExpansion.None); //->修改界面打开时自动折叠
                //if (Permissions.IsUseIds4)
                //{
                //    c.OAuthClientId("blogadminjs");
                //}
                // 路径配置,设置为空,表示直接在根域名(localhost:8001)访问该文件,注意localhost:8001/swagger是访问不到的,去launchSettings.json把launchUrl去掉,如果你想换一个路径,直接写名字即可,比如直接写c.RoutePrefix = "doc";
                c.RoutePrefix = "";