0

I am getting this error when trying to debug in vs 2015: localhost refused to connect.

Here's the situation:

  1. I am running vs 2015. I have been using this machine and this installation of vs2015 for 3 years. In fact both machine and vs was there before I got to my job. I was working on a c#/telerik project that I've been working on for the same 3 years. Everything has worked fine.
  2. I changed some code (no configuration items) that used a telerik radgrid. I got to a point where I was able to go into edit mode but did not update the data entered in edit mode.
  3. I didn't close vs or reboot or do anything except try to run in debug after the last code change I mentioned above. I got an error saying that local host could not be reached.
  4. I tried other projects with the same application that I was working on and also tried projects with other applications and ALL OF THEM GAVE THE SAME ERROR: local host could not be reached. So this doesn't look like an issue in my project.
  5. I uninstalled and reinstalled iis express 10 (that seems to be what is used in debug mode from what I've read). This did not fix the problem
  6. As an experiment I ran the original project in non-debug mode (ctrl-F5) and IT DID WORK.
  7. I've tried changing the applicationhost.config in iis express per a post I found: "change the managedruntimeversion from "v4.0" to "v4.0.30319" for .net 4.5 <add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0.30319" managedPipelineMode="In

This is quite confusing. We did have some window updates that didn't quite work but they were attempted at least a day before this problems came up; so it seems unlikely these updates caused the error. I have gone through many posts with no success but I'll point out that none of them address the debug vs non debug mode very clearly; I don't know for sure what version of iis is used by either debug or non-debug mode . I have a feeling this is an issue with debug mode and possibly iis express but I can't be sure. Any help would be appreciated. I am considering reinstalling vs 2015 but I hope to avoid that.

Neil

  • Check whether something changed in the config file used by IIS Express, https://docs.jexusmanager.com/getting-started/features.html#add-iis-express-from-visual-studio-2015-2017-2019-solution-file – Lex Li Nov 07 '22 at 18:31
  • Thank you. I have seen this issue mentioned on other posts. I found that this is not a project issue-any project I try to debug gives me the same error. And I found that if I run the project without debug it works fine. So my conclusion is this is either iis express or visual studio. By the way I uninstalled iis express and reinstalled it. I had deleted the config file but when I reinstalled iis express it came back. I can't tell what changed because I never had a reason to look at the config file before; I hope that the reinstall might fix that . Should I re-install visual studio? – Neil Newton Nov 07 '22 at 21:40
  • Did you try to delete .vs folder and restart Visual Studio as an Administrator like [this](https://www.youtube.com/watch?v=zMdp2zm8w7U)? – Jingmiao Xu-MSFT Nov 08 '22 at 01:54
  • I took one project and did what you said: – Neil Newton Nov 08 '22 at 13:55
  • I took one project and did what you said: Deleted the vs folder after making hidden files visible. Then I opened the project with administrator rights. It didn't work. I need to clarify the fact that this error is happening with any project I try so I don't think this is problem in one project. And the error doesn't occur (the app runs) when I run this with ctrl-F5 (no debug) so I believe this may be a problem with iis express. – Neil Newton Nov 08 '22 at 14:16
  • I wanted to make sure that when you say to delete the vs folder you are referring to a vs folder in a single project or if there is a more general user vs folder. I ask this because, in looking into the possible iis express issue I noticed there was an applicationhost.config in both projects and a general one for my user iis express config folder. Is there a vs folder for the user as well? – Neil Newton Nov 08 '22 at 14:21
  • Again, this error occurs in any project I try to debug so I'm pretty sure this can't be fixed inside of one project. Also I have reinstalled iis express 10 and the error is still there. Any ideas on iis express that might be causing this? – Neil Newton Nov 08 '22 at 14:24
  • Have you tried changing the port number in the project URL? – YurongDai Nov 09 '22 at 09:26
  • Thanks for answering. I have heard about changing the port but I have resisted it because all the project I've tried debugging give me the same error. In other words this is not a problem limited to one project. And when I ran it without debug ctrl+F5 the error went away even though the port is the same one that was used when I tried to debug – Neil Newton Nov 09 '22 at 21:00
  • Thanks. I have heard about changing the port but I have resisted it because all the project I've tried debugging give me the same error. And ctrl+F5 works even though the port is the same one used by debug.I am confused by iis express (which many posts say controls debugging). But most posts discuss debugging and iis express in terms of a single project. I would appreciate clarification on whether I have to somehow "run" iis express after reintalling it. It's not a service. But I will try your suggestion. I'd appreciate information on what iis express needs after it is reinstalled. – Neil Newton Nov 09 '22 at 21:14
  • Just to let you know. I took an older working version of my project and changed the port. Honestly I'm not sure if there is any rules for changing a port so I just changed on number at the end of the port number. The error still occurs. Let me know if there are rules for changing port numbers. Again, this error does occur no matter what project I am trying to debug. That may mean that this is not an issue in a single project but debugging simply stopped working. Let me know if anyone has any thoughts? – Neil Newton Nov 09 '22 at 21:22
  • Forgot to ask, are you using Google Chrome? This way only applies to Chrome:1. Open it in your browser: `chrome://net-internals/#hsts` 2. Go to Delete Domain Security Policy 3. Enter "localhost" 4. Restart your browser – YurongDai Nov 11 '22 at 08:24
  • At the moment I am using IE because it is traditionally what we have used for development. But I prefer chrome. I'll try this because the app is being run in Chrome since when edge showed up we had some javascript problems that weren't there before. – Neil Newton Nov 11 '22 at 17:42
  • YurongDai-This has been so confusing mostly because of the fact that I'm using vs2015. There used to be clear guidance for this problem with this older software. But the old posts to help with this problem are obsolete (e.g. attachment as a workaround don't work because the old processes that were recommended by old posts are either no longer in the processes list or the one that is just exits the process). This is for IE which is our traditional development browser. But this worked!!!!! Thanks you so much!!! I remain suspicious about possible problems in the future but Thanks! – Neil Newton Nov 11 '22 at 18:12

0 Answers0