'visual studio is running, but localhost can't connect
I have vs 2015, and a asp.net mvc 5 website. It was running fine until a while back, but just today I noticed it stopped working. When I start debugging, visual studio is running fine, and so is IIS Express, but localhost page cannot be found.
This is what my IIS Express.
And the visual studio
And the browser
I cannot figure out what is wrong. Things I've tried, which didn't help:
1) Reinstall (clean) IIS Express 10
2) Deleted the folder C:\Users\Razor\Documents\IISExpress
so that when visual studio is restarted, it creates the folder again.
3) Deleted the Solution folder's .vs
directory (that contains the applicationhost.config) and it was re-created again.
None of the above methods have worked. Can anyone help me figure out what's going wrong in here?
Solution 1:[1]
Close IIS EXPRESS and try again
EDIT : I know that this sound a little bit crazy but try to disable Firewall and re-enable it. This is working for me.
Solution 2:[2]
I am also facing same problem , after lots of efforts like deleting IIS profile , adding firewall rules and opening vs in administrator mode and many other....
i found solution.
1) Stop all those application who uses IIS
2) Edit file %userprofile%\Documents\IISExpress\ApplicationHost.config.
3) find your solution name inside of all registred sites
<system.applicationHost>
<sites>
<site name="YourSolutionName" id="2">
<application path="/" applicationPool="YourApplicationPoolName">
<virtualDirectory path="/" physicalPath="YourSolutionPath" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:1234:localhost" />
</bindings>
</site>
</sites>
</system.applicationHost>
Confirm Port number in bindingInformation.
4) Now go to your visual studio.
5) Right click on solution -> Go to properties -> Inside Web tab set Project URL : http://localhost:1234/
also check Override application root URL check box. Set this URL also http://localhost:1234/
6)Save this and run application.
Note : While changing ApplicationHost.config file you found multiple instances of your code. you have to find latest port and update it with your port number.
Solution 3:[3]
What worked for me was to repair IIS Express 10 (Or the version you got) from the control panel
Solution 4:[4]
Please follow the below step:
Remove the directory %userprofile%\Documents\IISExpress.
Delete the applicationhost.config file which is placed within the .vs\Config\ folder in your Visual Studio project root folder.
Restart the Visual Studio with run as Administrator.
Run the your project.
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 | |
Solution 2 | Dinesh Deshpande |
Solution 3 | Enrique Bernal |
Solution 4 | Sumant Singh |