swagger-document-override / md-override-loader - FAILED

问题描述 投票:3回答:1

当我将它托管在运行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\@[email protected]\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运行启动api,但它没有帮助。

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

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

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

.net-core swashbuckle autorest
1个回答
0
投票

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

尝试用http://localhost ...

© www.soinside.com 2019 - 2024. All rights reserved.