【问题标题】:Swagger for Azure Service Fabric Stateless Web API applicationAzure Service Fabric 无状态 Web API 应用程序的 Swagger
【发布时间】:2016-10-17 14:05:55
【问题描述】:

我正在开发 Web API 服务并在 Azure Service Fabric 上作为微服务进行托管。我需要为 API 定义实现 Swagger,我可以看到 SwaggerConfig.Register() 方法在应用程序启动时没有调用。所以我无法访问http://faricurl:8000/swagger

那么请您指出如何为 Web API 应用程序集成 Swagger 定义。

非常感谢,Thirumalai M

【问题讨论】:

标签: azure azure-service-fabric


【解决方案1】:

按照我的评论中的建议安装核心 Swashbuckle NuGet 包

install-package Swashbuckle.Core

然后在你的 WebApi 项目的 Startup.cs 中添加

 config.EnableSwagger(c => c.SingleApiVersion("v1", "A title for your API"))
        .EnableSwaggerUi();

【讨论】:

    猜你喜欢
    • 2016-08-27
    • 2017-10-15
    • 2016-08-17
    • 2020-02-20
    • 1970-01-01
    • 2016-09-11
    • 2019-07-24
    • 2015-12-24
    • 2023-01-30
    相关资源
    最近更新 更多