Swagger for Azure Service Fabric无状态Web API应用程序 [英] Swagger for Azure Service Fabric Stateless Web API application

查看:73
本文介绍了Swagger for Azure Service Fabric无状态Web API应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am developing Web API service and hosting on Azure Service Fabric as Micro Service. I need to implement Swagger for the API definition and I could see SwaggerConfig.Register() method not calling while application is starting. So I could not access http://faricurl:8000/swagger.

所以您能指出如何为Web API应用程序集成Swagger定义.

So can you please point out how to integrate Swagger definition for Web API application.

非常感谢Thirumalai M

Many Thanks, Thirumalai M

推荐答案

按照我的注释中的建议,安装核心Swashbuckle NuGet软件包

As suggested in my comment install the core Swashbuckle NuGet package

install-package Swashbuckle.Core

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

Then in the Startup.cs of your WebApi project add

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

这篇关于Swagger for Azure Service Fabric无状态Web API应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆