Search code examples
visual-studiossliis-express

SSL Certificate failing in IIS Express


I am hoping someone can shed some light on this situation. I have a WEB API that I am running in IIS Express. I was using it with SSL enabled. I have a console application that calls it like so:

https://localhost:12345/api/Controller/Method/arg

This was working great up until today. All of a sudden the client throws an exception when trying to connect stating:

The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

I have gone through and made sure that the IIS Express Development Certificate is in place under personal certificates. I have also done a repair on IIS Express. I also do not get this problem if I put the URL into Internet Explorer. I have no problem connecting to the WEB API when I go over normal HTTP. What would make this seemingly start happening for no reason?


Solution

  • Misha Beskin's answer to this question resolved it for me. Still no idea what caused it to get messed up in the first place.

    After spending a lot of time for me the solution was pretty simple

    I just opened the Certmgr.msc ---> deleted the localhost certificate from the Trusted Root certification authorities.

    Then opened my solution (after I had run the identity sever) clicked run the visual studio asked fro me if I want generate new certificate to iis express (ssl), I had clicked yes and then it started to work properly:)