localhost refused to connect Error in visual studi

2019-01-14 10:51发布

I have copied my solution file from another system and tried to run it on my machine: For this, I have gone to the project folder and deleted the previous solution file and copied the new one.

Now, it started giving me error. connection refused etc. So, I got one solution from here: How to solve ERR_CONNECTION_REFUSED when trying to connect to localhost running IISExpress - Error 502 (Cannot debug from Visual Studio)?

According to it, I changed the port number from 1049 to 1052. It loaded and one of the pages gets loaded. But when I entered the desired login credentials then it redirected to the older port again, like this:

http://localhost:1049/Home/SearchFlight

and the error is:

 This site can’t be reached

 localhost refused to connect.
 Search Google for localhost 1049 Home Search Flight
 ERR_CONNECTION_REFUSED

Now, I don't know what to do from here. I have changed the port number to 1052 but still its pointing to 1049. What should i do now?

21条回答
劫难
2楼-- · 2019-01-14 10:59

I ran my Visual Studio as "Run as administrator" and this solved my problem.

查看更多
不美不萌又怎样
3楼-- · 2019-01-14 11:01

I had to add https bindings in my local IIS

查看更多
叛逆
4楼-- · 2019-01-14 11:03

For this to work for me, all I had to do was recreate the virtual directory. I had re-installed Windows and then pulled the project back out of Git. To do this, right-click on the solution project and choose Properties, then go to the Web tab and click the Create Virtual Directory beside the Project Url.

I hope this helps someone else too!

Bud

查看更多
小情绪 Triste *
5楼-- · 2019-01-14 11:09

I had a similar issue. Try this and it should work

  1. Go to your project folder and open .vs folder (keep your check hidden item-box checked as this folder may be hidden sometimes)

  2. in .vs folder - open config

  3. see that applicationhost config file there? Delete that thing.(Do not worry it will regenerate automatically once you recompile the project.)

查看更多
趁早两清
6楼-- · 2019-01-14 11:09

Project properties> Web > Create Virtual Directory worked for me

查看更多
趁早两清
7楼-- · 2019-01-14 11:10

I solved a similar problem by listing bound IP addresses in a cmd window running as admin:

netsh http show iplisten

Then, one by one, blowing them all away:

netsh http delete iplisten ipaddress=127.0.0.200
netsh http delete iplisten ipaddress=127.0.0.2
...
查看更多
登录 后发表回答