当我在运行IIS的服务器2012R2上托管Autorest时,我可以使用我的api使用Autorest生成代码
然而,当我尝试使用localhost url运行它时,我得到了一条run not read消息。
我可以在浏览器中阅读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,但是没有帮助。
我尝试使用admin特权在dos命令shell中运行autorest。
根据github的问题,我可以将swagger.json保存到一个文件中,并通过引用该文件生成代码。
这不是一个很好的解决方案。
发布于 2019-03-27 03:37:23
您是否正在尝试将https与localhost一起使用?如果你没有在上面放上证书,你就不应该使用https。
用http://localhost试试吧……
https://stackoverflow.com/questions/53508432
复制相似问题