IIS を実行しているサーバー 2012R2 でホストするときに、API で Autorest を使用してコードを生成できます
ただし、ローカルホストの 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'.
github で問題を調査した後、 dotnet run を使用して API を開始しようとしましたが、役に立ちませんでした。
管理者権限でdosコマンドシェルでautorestを実行してみました
githubの問題に従って、swagger.jsonをファイルに保存し、ファイルを参照してコードを生成できます。
それは素晴らしい解決策ではありません。