Unable to find an OpenAPI description error in .net 6 REPL CLI tool
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}

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 :
- I made sure the app was running in another terminal (using the Windows terminal windows app or open a new terminal in vs code)

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