SSL Certificate problems when trying to use httprepl on ASP.NET tutorial


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.


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.

Answered By – Danil

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published