Failed to authenticate HTTPS connection. Conflicting certificates for localhost when using Visual Studio for Mac

Lately, I have been trying Visual Studio for Mac as this version of Visual Studio has evolved significantly. However, something I noticed is that since I don’t use it often, the local SSL certificates created by dotnet in the Mac get a bit screwy.

There is a possibility that you might end up with a conflicting certificate for localhost from creating or setting up applications in the past.

If you work with the Mac version of Visual Studio, and you ever get the following error, run the commands at the bottom to clean up the existing certificates for localhost and create new ones.

Failed to authenticate HTTPS connection. System.IO.IOException: Authentication failed because the remote party has closed the transport stream.

Open the terminal window, browse to your dotnet project and execute the following commands:

$dotnet dev-certs https --clean
$dotnet dev-certs https

Happy coding!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.