'This site can’t provide a secure connection

When I added the URL rewrite code in web.config and then publish it into azure. it will automatically redirects to https even I am trying to access website with http.

<rewrite>
  <rules>
    <rule name="Redirect to https">
      <match url="(.*)"/>
      <conditions>
        <add input="{HTTPS}" pattern="Off"/>
      </conditions>
      <action type="Redirect" url="https://{HTTP_HOST}/{R:1}"/>
    </rule>
  </rules>
</rewrite>

But when I run the same code in my local machine it gives the below error.

This site can’t provide a secure connection

enter image description here

How can I resolve the above error when I run the above code in my local machine?



Solution 1:[1]

This always solves the issue for me.

  • In Solution Explorer, click your project.
  • Hit the F4 key (view properties).
  • Copy the URL (NOT the SSL URL).
  • Paste the URL into the Project Url on the Web Tab, Save.
  • In Solution Explorer, click your project.
  • Hit the F4 key (view properties).
  • Change SSL Enabled to false.
  • Change it back to true. There should be a new SSL URL. Copy it.
  • Paste the new SSL URL into Project URL on Web tab. Click Create Virtual Directory.
  • Click Override application root URL, and paste in SSL URL. Save.

Solution 2:[2]

You will have to configure Visual Studio Server to be used with HTTPS. Please go through this link for details:
HTTPS with Visual Studio's built-in ASP.NET Development Server

Solution 3:[3]

I solved this problem with older version of Chrome web browser.

This is the list of older chrome versions where you can download and install it.

60.0.3112.90 - for Ubuntu is the version that works just fine for me.

Maybe it's little slower then newer versions but i found it's pretty good for production (:

Solution 4:[4]

On my end, I found out that there was a javascript code that redirects the site from http to https. So try to explore your environment if there are other code responsible for that issue. Hope this can help. Thanks

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jesse
Solution 2 Community
Solution 3 Milosh
Solution 4 jayz