【问题标题】:swagger-document-override/md-override-loader - FAILEDswagger-document-override/md-override-loader - 失败
【发布时间】:2019-04-29 17:03:31
【问题描述】:

当我将 Autorest 托管在运行 IIS 的服务器 2012R2 上时,我能够通过我的 api 使用 Autorest 生成代码

但是,当我尝试使用 localhost url 运行它时,我收到一条无法读取的消息。

我可以在浏览器中读取 swagger.json

我正在使用命令

autorest --input-file=https://localhost:44348/api-docs/v1/swagger.json
--output-folder=generated --csharp --namespace=DD.MyApp.Connector

输出是

AutoRest code generation utility [version: 2.0.4283; node: v10.11.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
   Loading AutoRest core      'C:\Users\kirst\.autorest\@microsoft.azure_autorest-core@2.0.4289\node_modules\@microsoft.azure\autorest-core\dist' (2.0.4289)
   Loading AutoRest extension '@microsoft.azure/autorest.csharp' (~2.3.79->2.3.82)
   Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.55->2.3.55)
FATAL: swagger-document-override/md-override-loader - FAILED
FATAL: Error: Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.
FATAL: swagger-document/loader - FAILED
FATAL: Error: Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.
Process() cancelled due to exception : Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.
  Error: Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.

在学习the issue on github 之后,我尝试使用 dotnet run 启动 api 但它没有帮助。

我尝试在具有管理员权限的 dos 命令 shell 中运行 autorest

根据 github 问题,我可以将 swagger.json 保存到文件并通过引用该文件生成代码。

这不是一个很好的解决方案。

【问题讨论】:

标签: .net-core swashbuckle autorest


【解决方案1】:

您是否尝试将 httpslocalhost 一起使用?如果你还没有在那里放证书,你不应该使用https

试试http://localhost...

【讨论】:

  • 它在 https 上运行良好(正如我所说,它现在正在运行)我在解决方案的“调试”选项卡中选中了启用 SSL。
猜你喜欢
  • 2011-01-21
  • 1970-01-01
  • 2011-09-03
  • 2018-01-05
  • 1970-01-01
  • 1970-01-01
  • 2020-05-29
  • 2019-11-14
  • 1970-01-01
相关资源
最近更新 更多