title: ASP.NET Core 3.1 app on IIS Express: "This site can't be reached"
body: <p>I'm working on an ASP.NET Core application that I have upgraded from v2.2 to v3.1. </p>
  
  <p>When I start the application using IIS Express without SSL enabled, I get this error in Google Chrome: </p>
  
  <blockquote>
    <p>This site can't be reached. localhost refused to connect. </p>
  </blockquote>
  
  <p>When I enable SSL, I get this error instead: </p>
  
  <blockquote>
    <p>This localhost page can't be found. No web page was found for the web address: <a href="https://localhost:44367" rel="nofollow noreferrer">https://localhost:44367</a>. </p>
  </blockquote>
  
  <p>I have have an IIS website configured to the directory where my application sits. In the project settings, I can set the 'Launch' setting to 'IIS', but when I do this I also get the same error. </p>
  
  <p>Screenshot of my web project settings: <a href="https://i.stack.imgur.com/CDOqg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CDOqg.png" alt="enter image description here"></a>. </p>
  
  <p>When I create a new blank ASP.NET Core 3.1 web project and run it with the same settings on IIS Express, it runs fine. </p>
  
  <p>Based on suggestions elsewhere, I have tried the following: </p>
  
  <ul>
  <li>Cleaning and rebuilding</li>
  <li>Deleting the .vs folder in the web project</li>
  <li>Changing the port number (currently it is localhost:54236). </li>
  <li>Enabling/disabling SSL </li>
  <li>Restarting my machine</li>
  <li>Loading up a fresh copy of my solution from Git on a separate working directory and trying to run it. </li>
  </ul>
  
  <p>I'm at a loss. </p>
  
  <p>Here is my launchSettings.json file: </p>
  
  <pre><code>{
    "iisSettings": {
      "windowsAuthentication": false,
      "anonymousAuthentication": true,
      "iis": {
        "applicationUrl": "http://myapplication.debug",
        "sslPort": 0
      },
      "iisExpress": {
        "applicationUrl": "http://localhost:54236",
        "sslPort": 44367
      }
    },
    "profiles": {
      "IIS Express": {
        "commandName": "IISExpress",
        "launchBrowser": true,
        "environmentVariables": {
          "ASPNETCORE_ENVIRONMENT": "Development"
        }
      },
      "Web": {
        "commandName": "Project",
        "launchBrowser": true,
        "environmentVariables": {
          "ASPNETCORE_ENVIRONMENT": "Development"
        },
        "applicationUrl": "https://localhost:5001;http://localhost:5000"
      }
    }
  }
  </code></pre>
  
  <p>When comparing with the launchSettings.json file of a fresh project I can't see any notable difference. Is there anything else that would cause this failure? </p>
  
  <p>I should note that I did change the port number - it was initially at port number 50192, but when I attempt to run the website to that address (<a href="http://localhost:50192" rel="nofollow noreferrer">http://localhost:50192</a>) it gives me a different error: <a href="https://i.stack.imgur.com/np681.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/np681.png" alt="enter image description here"></a></p>