6

I'm new to C# and .NET and I'm trying to follow the "Create a web API" tutorial on the Microsoft site. At the Test PostTodoItem section, I followed the instructions to install httprepl and tried to execute the following two commands:

httprepl https://localhost:5001/api/todoitems
post -h Content-Type=application/json -c "{"name":"walk dog","isComplete":true}"

I get the following error in my terminal: The SSL connection could not be established, see inner exception.. Screengrab: enter image description here

I've tried to follow various instructions to update the SSL certificates on my machine. For example, when I type dotnet dev-certs https --trust I get the following:, screenshot of response to dotnet dev-certs https --trust

The A valid HTTPS certificate is already present. response would suggest that I've fixed the issue, but I still can't get httprepl to run correctly. I've tried it on a Windows machine and it works fine (they have a much simpler way of handling SSL requests/granting permissions).

I can run the app/API in my browser, so I don't think I need to make any changes where Firefox/Chrome are concerned?

I've looked at other stack overflow solutions and they either don't work or I don't understand them. My dotnet --version is 6.0.101.

I'm pretty sure I've created SSL certificates for this already. I have a file called https.crt in my /usr/local/share/ca-certificates/aspnet folder: screenshot of https.crt

I don't know if it's relevant, but it has "DNS: localhost' there at the bottom. Can anyone explain how to troubleshoot/resolve this so I can get the tutorial working? I tried following this solution but I was unable to copy the localhost.crt into my /usr/local/share/ca-certificates/ folder. I compared the localhost.crt with my existing https.crt and it looked nearly identical, so I guessed it wouldn't fix anything.

JimmyTheCode
  • 3,783
  • 7
  • 29
  • 71

1 Answers1

1

There is a workaround that works just as well as httprepl (but without this problem). You can use VSCode "Rest Client" extension to run http requests described in .http files. It automatically configures CA certificate. The "HTTP Client" plugin of Jetbrains Rider works the same way.

Danil
  • 58
  • 5