title: How to solve ERR_CONNECTION_REFUSED when trying to connect to localhost running IISExpress - Error 502 (Cannot debug from Visual Studio)?
body: <p>This is running on Windows Server 2008 and used to work several months ago.  I am just now using this server again for some dev work with VS.</p>
  
  <p>This is live web server used to serve up a few test sites as well.</p>
  
  <p>This came up when running Visual Studio, then launching my projects for debugging.</p>
  
  <p>Trying to launch any site through <code>localhost:xxxx</code> when IISExpress has been launched (using actual port #'s in the config to access different sites):</p>
  
  <pre><code>This webpage is not available
  
  ERR_CONNECTION_REFUSED
  </code></pre>
  
  <p>I have been at this for a few days already, as I have read others have had similar issues, tried <a href="https://stackoverflow.com/questions/15584862/iis-express-not-working-in-visual-studio-2012">most things</a> I have read including changing the <code>managedruntimeversion</code> from "v4.0" to "v4.0.30319" for .net 4.5 (I have never had to do this before) and disabling the logging module (all suggestions found <a href="https://stackoverflow.com/questions/15584862/iis-express-not-working-in-visual-studio-2012">here</a>).</p>
  
  <p>There are only two entries in my <code>hosts</code> file that point to internal server IP addresses.  No <code>localhost</code> related IP's or references.</p>
  
  <p>I have gone as far as re-installing IIS Express, and Visual Studio 2013. I also created a brand new <code>WebApplication</code> site to try to resolve this (simple and no other complicated bindings).</p>
  
  <p>When I spin up Fiddler, I see the following on the page:</p>
  
  <pre><code>[Fiddler] The socket connection to localhost failed. 
  ErrorCode: 10061. 
  No connection could be made because the target machine actively refused it 127.0.0.1:23162
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/5JEJu.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5JEJu.png" alt="Fiddler capture"></a></p>
  
  <p>I have removed all proxy settings from IE's LAN connection section, where before I was getting a <em>red-x</em> popup in VS indicating something like <em>IISExpress could not launch</em>.</p>
  
  <p>This is not a matter of SSL vs non SSL.</p>
  
  <p>I had TFS Server installed - uninstalled that in case there were some odd bindings that were interfering.</p>
  
  <p>I tried deleting the IISExpress config/settings folder several times.</p>
  
  <p>Current <em>applicationhost.config</em> contains:</p>
  
  <pre><code>&lt;site name="WebApplication1" id="4"&gt;
                  &lt;application path="/" applicationPool="Clr4IntegratedAppPool"&gt;
                      &lt;virtualDirectory path="/" physicalPath="C:\TFS-WorkRepository\Sandbox\WebApplication1\WebApplication1" /&gt;
                  &lt;/application&gt;
                  &lt;bindings&gt;
                      &lt;binding protocol="http" bindingInformation="*:23162:localhost" /&gt;
                  &lt;/bindings&gt;
              &lt;/site&gt;
              &lt;siteDefaults&gt;
                  &lt;logFile logFormat="W3C" directory="%IIS_USER_HOME%\Logs" /&gt;
                  &lt;traceFailedRequestsLogging directory="%IIS_USER_HOME%\TraceLogFiles" enabled="true" maxLogFileSizeKB="1024" /&gt;
              &lt;/siteDefaults&gt;
              &lt;applicationDefaults applicationPool="Clr4IntegratedAppPool" /&gt;
  </code></pre>
  
  <p>I wish there was a tag for <code>really-stuck</code>.</p>
  
  <p>Please suggest away, as I don't want to go as far as spinning up a new server.</p>
  
  <p><strong>-- UPDATE --</strong></p>
  
  <p>In the URL bar, when I enter the computer name or IP address :xxxx I get the <code>ERR_CONNECTION_TIMED_OUT</code> rather than <code>ERR_CONNECTION_REFUSED</code>.</p>