I am developing an ASP.NET Core and when the run it in Visual Studio, it opens this url:
https://localhost:44392/
Now if I try to open this url http://localhost:44392/
, I will get this error:
This site can't be reached
The connection was reset.
I try to comment out this line of code
app.UseHttpsRedirection();
in the startup.cs
file, but that did not solve the issue.
Any advice?
EDIT
The launchsettings.json
is as follow:-
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:59662",
"sslPort": 44392
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"***: {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
CodePudding user response:
you are supposed to set it when you setup the app by unchecking the "configure for HTTPS" box see here
another option is to connect to HTTPS and trust the VS localhost certificate as written Here.
CodePudding user response:
Not clear what is the question. The site runs on port 44392 on HTTPS. Obviously, you can't access this port of HTTP. Do you want to access over http for some reason? If yes, then look in Properties\launchSettings.json
. you will see something like this:
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:5151/",
"sslPort": 44392
}
}
In this case you can access your site over http://localhost:5151/
, but depending on the UseHttpsRedirection()
it may redirect to HTTPS anyway.
If that's not what you are asking - please elaborate
UPDATE: So, with launchsetting.json
the way you have it - does this answer your question? you should be able to access your site http://localhost:59662
assuming you run through IIS