[Solved] ERR_CONNECTION_RESET with SSL and ASP.NET

I was in the process of migrating an application from forms authentication to Azure identity authentication. Initially, everything seemed straightforward, especially since I had another application already functioning with the new authentication method. However, my optimism quickly waned when I encountered unexpected issues during testing.

Upon inspecting the setup, I found that despite setting everything up correctly and migrating the code, the authentication process wasn’t successful. The initial hiccup was with the nonce, where it was set to true but appeared null during testing. Oddly, although I could observe a nonce in the post to the authenticate endpoint, the external authentication callback URL breakpoint wasn’t triggering at all.

After scouring through Stack Overflow for solutions, I stumbled upon a crucial clue buried within a post:

https://stackoverflow.com/a/63556294/5906543

A noteworthy observation emerged: the working site was configured with HTTPS, while the problematic site relied on HTTP, despite both running on localhost. Could it really be that simple?

To rectify this issue, I followed these two primary steps to revert the site back to HTTPS:

  1. Adjust the project settings in Visual Studio to utilize HTTPS. (Instructions on how to do this can be found in the project settings.)
  2. Implement a self-signed certificate for localhost:port. This involves opening Command Prompt with administrative privileges, navigating to “C:\Program Files (x86)\IIS Express,” and executing the command:
IisExpressAdminCmd.exe setupsslUrl -url:https://localhost:PORT/ -UseSelfSigned

Replace “PORT” with the specific port you’re utilizing.

By addressing these steps, hopefully, you can resolve any ERR_CONNECTION_RESET issues related to SSL and proceed with your coding tasks smoothly..

[EDIT] There are obviously many ways this error can come about, and when I went to use my project on a new machine it wouldnt work any more 😢 I ended up finding this on Stack Overflow:

I was getting ERR_CONNECTION_RESET because my Visual Studio 2013/IIS Express configured app port number was NOT in the range :44300-:44398. (I don’t recall having to dismiss any warnings to get out of that range.) Changing the port number to something in this range is all I had to do to make it work.

I noticed this after reviewing the netsh http show sslcert > sslcert.txt output and something clicking with stuff I read recently about the port numbers.

Stack Overflow

I hope one of these solutions works for you 😎


Posted

in

,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *