Unable to find an OpenAPI description error in .net 6 REPL CLI tool

Obomighie Sophie
2 min readDec 8, 2021

Exercise — Create a web API project — Learn | Microsoft Docs

Hello friends,

I am presently using the course above to practice building APIs with .NET 6 and C# 10.

I came across this error when I ran

httprepl https://localhost:{PORT}

Unable to find an OpenApi description

and when I ran ls, I saw this :

No directory structure has been set, so there is nothing to list. Use the “connect” command to set a directory structure based on an OpenAPI description.

In addition, when I changed directory into the Weather Forecast directory and ran the get command, I got this error

No connection could be made because the target machine actively refused it. (localhost:7122)

How I fixed this issue :

  1. I made sure the app was running in another terminal (using the Windows terminal windows app or open a new terminal in vs code)
App running in another terminal

2. I then ran the following command in another terminal (the terminal in vscode but any other works)

dotnet dev-certs https — trust

3. I then ran

dotnet add WebAPI.csproj package Swashbuckle.AspNetCore -v 5.6.3

(replace webapi.csproj with your-api-name.csproj)

4. I ran

httprepl http://localhost:7122 — openapi /swagger/v1/swagger.json

5. I ran the ls command and now the WeatherForecast controller displays

I hope this helps.

Post also on my blog.

References

  1. c# — Why is HttpRepl unable to find an OpenAPI description? The command “ls” does not show available endpoints — Stack Overflow
  2. Test web APIs with the HttpRepl | Microsoft Docs
  3. Exercise — Create a web API project — Learn | Microsoft Docs
  4. Unable to find an OpenAPI description — Giters
  5. No connection could be made because the target machine actively refused it (net-informations.com)
  6. c# — No connection could be made because the target machine actively refused it 127.0.0.1:3446 — Stack Overflow
  7. Test web APIs with the HttpRepl | Microsoft Docs

--

--