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

推荐订阅源

V
Visual Studio Blog
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
小众软件
小众软件
Last Week in AI
Last Week in AI
月光博客
月光博客
博客园 - 聂微东
Recent Announcements
Recent Announcements
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
博客园 - Franky
云风的 BLOG
云风的 BLOG
量子位
N
Netflix TechBlog - Medium
Hugging Face - Blog
Hugging Face - Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
博客园 - 司徒正美
S
SegmentFault 最新的问题
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News
宝玉的分享
宝玉的分享

博客园 - 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