Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERR_SSL_PROTOCOL_ERROR for localhost from Visual Studio debug

I am running a simple ASP.net web application. Chrome is showing the below error after running this.

localhost sent an invalid response.
Try running Windows Network Diagnostics.
ERR_SSL_PROTOCOL_ERROR

but my application is on http, not https.

enter image description here

but the URL is loading with https://localhost:54056/

config is also pointing to http only.

 <site name="tan-square" id="2">
            <application path="/" applicationPool="Clr4IntegratedAppPool">
                <virtualDirectory path="/" physicalPath="C:\Users\Myfolder\OneDrive\Downloads\tan-square" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation="*:54056:localhost" />
            </bindings>
        </site>

I don't understand where the problem is. Why is it loading with https?

like image 530
James123 Avatar asked Mar 06 '20 05:03

James123


3 Answers

First, check your site web binding detail by the following detail:

1)Open visual studio, select your project.

2)right-click on the project and select properties.

3)under the Web tab and check your project url.

enter image description here

make sure there no such setting in your web.conifg file like below:

<system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="Strict-Transport-Security" 

        value="max-age=16070400; includeSubDomains" />
      </customHeaders>
    </httpProtocol>
</system.webServer>

When the browser sees this, it will remember, for the given number of seconds, that the current domain should only be contacted over HTTPS. In the future, if the user types http:// or omits the scheme, HTTPS is the default.

Clear your browser cache. another thing you could try to find the cause is open chrome. type chrome://net-internals/#hsts in url and querying for localhost:

enter image description here

The query shows “localhost” as being in the list of domains in the HSTS set.

The solution is deleting the domain from the cache. type “localhost” into the Delete domain text field, and hit Delete. After doing that when you query for “localhost” again you will receive a “Not found”.

enter image description here

like image 154
Jalpa Panchal Avatar answered Nov 15 '22 22:11

Jalpa Panchal


Just create new Virtual Directory:

1-right-click on the project and select properties.

2-under the Web tab change your project url by changing the localhost to http://localhost:48333/ .

3- click Create Virtual Directory.

4- make sure you don't have this in web.config

<system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="Strict-Transport-Security" value="max-age=16070400; includeSubDomains"/>
      </customHeaders>
    </httpProtocol>
</system.webServer>
like image 27
Jamal Qudah Avatar answered Nov 16 '22 00:11

Jamal Qudah


If you are running .net core, just run Visual Studio as admin, or go to bin\Debug\netcoreapp3.1 directory, and issue. Wierdly, .net core. .net core surprisingly dont give any error.

%USERPROFILE%\\.dotnet\\tools\\dotnet-lambda-test-tool-3.1.exe --port 5059

change port number to whatever.

like image 1
VineetYadav Avatar answered Nov 15 '22 23:11

VineetYadav