我正在开发 Web API 服务并作为微服务托管在 Azure Service Fabric 上。我需要为 API 定义实现 Swagger,并且我可以看到 SwaggerConfig.Register() 方法在应用程序启动时未调用。所以我无法访问http://faricurl:8000/swagger .
您能否指出如何为 Web API 应用程序集成 Swagger 定义。
非常感谢,Thirumalai M
最佳答案
按照我的评论中的建议安装核心 Swashbuckle NuGet 包
install-package Swashbuckle.Core
然后在 WebApi 项目的 Startup.cs 中添加
config.EnableSwagger(c => c.SingleApiVersion("v1", "A title for your API"))
.EnableSwaggerUi();
关于azure - 适用于 Azure Service Fabric 无状态 Web API 应用程序的 Swagger,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40088573/