【问题标题】:How to change https://<your-url>/swagger to custom in Swagger如何在 Swagger 中将 https://<your-url>/swagger 更改为自定义
【发布时间】:2016-08-24 23:23:31
【问题描述】:

我的任务是将 Swagger 安装到 Web API 项目中。

已安装:来自 nuget 的最新版本的 Swashbuckle。 (Swashbuckle.Core.Net45 和 Swashbuckle.Net45)

自定义:App_Start\SwaggerConfig.cs。我能够自定义(更改样式、添加徽标、修改描述)..

现在我们需要从https://[your-url]/swagger 更改为https://[your-url]/help

请指教

【问题讨论】:

    标签: swagger swagger-ui swagger-2.0 swashbuckle swagger-editor


    【解决方案1】:

    更改SwaggerUIOptions参数的routePrefix,默认为“swagger”

    【讨论】:

      【解决方案2】:

      关注documentation怎么样?在您的情况下,您可以将 SwaggerConfig 更改为

      httpConfiguration
          .EnableSwaggerUi("help/{*assetPath}");
      

      然后可以在https://[your-url]/help/index找到文档

      【讨论】:

      • 如何将文档路径从 https://[your-url]/help/index 更改为 https://[your-url]/help 以及另外 - 使其适用于 https: //[your-url]/help 和 https://[your-url]/help/
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-11-25
      • 2016-11-09
      • 2021-02-25
      • 2017-02-19
      • 2017-01-27
      • 1970-01-01
      • 2018-11-15
      相关资源
      最近更新 更多