1

Intro:

When i run an asp.net web app that is freshly created, it runs just fine. However, it runs only for the 1st time. Subsequent runs will fail with this message:

enter image description here

The only way to make it run again is to restart VS2017. Not even restarting IIS/IISExpress will make it work again.

At this point my instincts tell me there is something stupid/silly going on. What on earth is going on here?

Here is my configuration:

  • I am using Visual Studio 2017 Version 15.8.4
  • .Net Framework Version 4.7.03056
  • Project: Asp.net Web Application (.Net Framework) ==> MVC
  • This is being run under - IIS Express (Internet Explorer)

Here are more details about the error im seeing:

The error page simply says "Can't reach this page".

When i click on the "More information" expansion link, i see following (mentioned above):

There was a temporary DNS error. Try refreshing the page.
Error Code: INET_E_RESOURCE_NOT_FOUND

Now, if i click on the "Fix connection problems" button, the Windows Network Diagnostics window popups up and says:

The remove device or resource won't accept this connection

If i click on "View detailed information" link at the bottom of this popup, i see following details:

The device or resource (localhost) is not set up to accept connections on port 'X' (where X is my localhost dev port).

enter image description here

Summary:

In the end, there is no real reason why port 'X' is not working any more. If i change the port number from Visual Studio the web app will run. But as i mentioned before, restarting Visual Studio will allow me to run for the 1st time.

* Updated *

I found a great work-around solution. Instead of running (F5), i simply choose a view (.CSHTML) and execute that view itself (right-click --> View in browser). This seems to work just fine every time without messing up the port.

AlvinfromDiaspar
  • 6,611
  • 13
  • 75
  • 140
  • FYI - this is starting to get really annoying! – AlvinfromDiaspar Oct 02 '18 at 18:16
  • Does the port still show up as listening on localhost in `netstat -ano` ? Is there any chance this is a IPv4 vs IPv6 issue - do you still get the same error if you try `http://127.0.0.1:11057/` instead? I can only think that you're crashing the web process somehow, and changing the port or restarting VS will restart it, but I can't imagine how that's happening. Is there anything in the system event log or [IIS Express logs](https://stackoverflow.com/a/5799798/243245) if you have them? – Rup Oct 03 '18 at 17:04
  • If i try http://127.0.0.1:11057, i still get the same error. – AlvinfromDiaspar Oct 03 '18 at 17:13
  • if i run the netstat -ano command, i dont see 127.0.0.1:11057 listed. – AlvinfromDiaspar Oct 03 '18 at 17:19
  • Standard questions: Did you try rebooting? Did you try running Visual Studio as Administrator? – jmbmage Oct 03 '18 at 20:21

0 Answers0