惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
B
Blog
Stack Overflow Blog
Stack Overflow Blog
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
Tailwind CSS Blog
MongoDB | Blog
MongoDB | Blog
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
Recent Announcements
Recent Announcements
U
Unit 42
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
腾讯CDC
D
DataBreaches.Net
Microsoft Azure Blog
Microsoft Azure Blog
G
Google Developers Blog
M
MIT News - Artificial intelligence
P
Proofpoint News Feed
罗磊的独立博客
L
LangChain Blog
V
Visual Studio Blog
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
宝玉的分享
宝玉的分享

博客园 - iDEAAM

logstash 如何从oracle 导入 pgsql IIS如何部署python django项目 IIS 如何部署net8 和 如何配置反向代理 ARR、URL Rewrite python 备份文件,从 D盘 到Z盘。并且保留15天的文件 git 如何排除 bin obj nginx 配置 自签名https证书 powershell 计划任务 定时任务 如何调用get接口 使用nssm在windows服务器上部署nodejs 退出远程桌面不锁屏 PDF 转 Excel 非常完美的java包 sublime 选择有规律的数据,同时快速编辑多行内容 去除重复行或者只保留唯一值 C#中 同步方法调用异步方法不死锁的方法 async await task windows 2008 r2 iis https 配置方法 vue js中,利用json数据临时生成一个可下载csv的功能 git常用命令 C#下载远程文件并打包 从 ASP.NET MVC 和 Web API 升级到 ASP.NET Core MVC c# 把现有图片顶部top50px 处理成白色 C# asp.net开源插件推荐:PdfiumViewer ( pdf 转成 图片png pdf convert to image )
在asp.net mvc中使用了owin startup如何使用 swagger插件
iDEAAM · 2023-03-13 · via 博客园 - iDEAAM

SwaggerConfig.cs

public class SwaggerConfig
    {
        public static void Register(HttpConfiguration config)
        {
            var thisAssembly = typeof(SwaggerConfig).Assembly;
            config
                .EnableSwagger(c =>
                    {
                        c.SingleApiVersion("v1", "webApi");
                        c.IncludeXmlComments(GetXmlCommentsPath());
                        c.ResolveConflictingActions(apiDescriptions => apiDescriptions.FirstOrDefault());
                        c.SchemaId(x => x.FullName);
                    })
                .EnableSwaggerUi(c => {
                });
        }

        static string GetXmlCommentsPath()
        {
            return System.String.Format(@"{0}\bin\webApi.xml",
            System.AppDomain.CurrentDomain.BaseDirectory);
        }
    }

Startup.cs

 public class Startup
    {
        /// <summary>
        /// Configures the application using the provided builder.
        /// </summary>
        /// <param name="builder">The current application builder.</param>
        public void Configuration(IAppBuilder builder)
        {
//swagger
            SwaggerConfig.Register(configuration);
   }

  
参考:https://www.andrewhoefling.com/Blog/Post/web-api-swagger-swashbuckle