在asp.net mvc中使用了owin startup如何使用 swagger插件
SwaggerConfig.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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
1 2 3 4 5 6 7 8 9 10 11 | 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
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决
2017-03-13 给Elasticsearch 5.2.2 设置用户权限 how to setting security for elasticsearch on windows
2015-03-13 Microsoft Dynamics CRM 数据库连接存储位置在哪里 是在注册表里
2009-03-13 技巧/诀窍:在ASP.NET中重写URL
2009-03-13 制造型企业ERP项目需求分析