'How to fix "This page can't be displayed" error in ASP.NET?
I was debugging a localhost asp.net and I have made some very minor code changes and ran it again and now I get an error I have never gotten before. In nice big blue letters it tells me "This page can't be displayed".
Apart from taking everything to forumula, what do you think would cause this error and how would I go about fixing it? It offers a button that says "Fix connection problems", but this is a localhost browser, so there are no connection, really. I clicked the button anyway and it did not offer any solution. I also refreshed the page, as suggested and it did nothing.
I test my localhost in the browser and it is working.
What do you think?
Solution 1:[1]
If it is functioning properly for you when debugging on local host, then I would assume it is a path/file resole issue. Trying doing what was mentioned earlier, and debugging it. That is why your localhost test works, but when placed on the server for the live version, it fumbles. I do not see any other reason that may cause this. Yes, it could be a browser issue, but is not really anything specific to conclude that. What were the changes you made? Is there a way you can post the code, or some of it?
Solution 2:[2]
I found the offensive part of code.
The code does a check on the URL and modifies it to make sure it is correct. This messes up the localhost url. The same if statement that checks for characters in the URL now also checks that string to see if there is a "localhost" and then side-steps the code.
Solution 3:[3]
I had the same problem. I fixed it by next steps:
- stop debug
- delete solution (I think this point is optional)
- get version from TFS (this point is optional with previous ;-) )
- close VS
- delete custom IISExpress config files in c:\Users\\Documents\IISExpress (delete whole folder)
- restart computer
- start VS
- start Debug
Application is running.
Solution 4:[4]
I am using Visual Studio 2017 and I had a similar problem. I tried @Vojta Novák's instructions to no avail.
However, I did find a solution that works for me.
Right-click on the web project, select "Properties" and select the "Web" tab on the properties. Change the port number in the Project Url and click [Create Virtual Directory]. Save and run the project.
I tried deleting the IIS Express configuration folder, but it seems like no matter what I do, if I try to run the web app under the port number it was on originally, I get an error.
What is even more baffling is the fact that I only could reproduce the error when browsing the web app with IE. With Chrome, it works fine.
Solution 5:[5]
I get this error sometimes after I publish. I just add an empty line to my web.config. Then run the app. It now works. Then stop and undo my change to my web.config.
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 | Casey ScriptFu Pharr |
Solution 2 | xarzu |
Solution 3 | Vojta Novák |
Solution 4 | Vivian River |
Solution 5 | JohnWrensby |