title: Kestrel created in Console app refuses connections
body: <p>This is a continuation of this issue.</p>
  <p><a href="https://stackoverflow.com/questions/62602901/find-2-different-free-ports-for-2-kestrel-servers">Find 2 different FREE ports for 2 kestrel servers</a></p>
  <p>I was able to start 2 kestrel servers from Console app using dynamic ports and on some computers it works fine, but sometimes this approach fails.</p>
  <p><strong>TLDR</strong></p>
  <ol>
  <li>Kestrel should create HTTP and HTTPS connection, but creates only HTTP</li>
  <li>Even when it says that HTTP connection was created it's not reachable</li>
  </ol>
  <p>For testing purposes, I created Firewall rule that opens all ports for all protocols and all apps, and then completely disabled Firewall itself. For clarity, I'm not using IIS and start Kestrel manually from C# Console application as local server.</p>
  <p><strong>Issues</strong></p>
  <ol>
  <li>Code in the link above should create HTTPS connection for each server, but on Windows Server 2012 and some Windows 10 Pro computers it creates only HTTP connection, although having HTTPS is not critical in this case if I knew how to solve another problem below. I think, it's because some update in Windows may require all HTTPS connections to have SSL certificate and as far as I don't provide it, server doesn't even try to create HTTPS connection. <strong>Is there a settings in Kestrel to ignore SSL certificate validation for localhost?</strong></li>
  </ol>
  <pre class="lang-cs prettyprint-override"><code>public static IWebHost Run&lt;T&gt;(ServerOptions options = null) where T : class
  {
    var configuration = new ConfigurationBuilder().Build();
  
    var urls = new[]
    {
      &quot;http://0.0.0.0:0&quot;,
      &quot;https://0.0.0.0:0&quot;
    };
  
    var environment = WebHost
      .CreateDefaultBuilder(new string[0])
      .ConfigureServices(o =&gt; o.AddSingleton(options))
      .UseConfiguration(configuration)
      .UseUrls(urls)
      .UseContentRoot(Directory.GetCurrentDirectory())
      .UseKestrel()
      //.UseIISIntegration()
      .UseStartup&lt;T&gt;()
      .Build();
  
    environment.RunAsync();
  
    return environment;
  }
  
  // Issue #1 
  // On some computers 
  // webAddresses = [&quot;http://0.0.0.0:50210&quot;, &quot;https://0.0.0.0:50220&quot;]
  // On other computers and even for 2 users on the same Windows server it doesn't create HTTPS 
  // webAddresses = [&quot;http://0.0.0.0:50210&quot;]
  
  var webEnvironment = Server.Run&lt;Startup&gt;();
  var webAddresses = webEnvironment.ServerFeatures.Get&lt;IServerAddressesFeature&gt;().Addresses; 
  </code></pre>
  <ol start="2">
  <li>Second issue is that on some computers the code gets executed without any error or exception and returns dynamic address for the server, e.g. <a href="http://0.0.0.0:50210" rel="nofollow noreferrer">http://0.0.0.0:50210</a> but when I try address <a href="http://127.0.0.1:50210" rel="nofollow noreferrer">http://127.0.0.1:50210</a> in a browser, it says that website cannot be reached and connection to this server was actively refused. I would blame some <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel?view=aspnetcore-3.1" rel="nofollow noreferrer">incompatibility issues</a> with Windows Server 2012 and Windows 8 and Kestrel, but I have <strong>Windows 10 VPS</strong> where this <strong>app works fine for one system user and cannot create HTTPS for another one</strong> and the only difference between those users is that I modified <a href="https://superuser.com/questions/1514511/iis-is-not-accessible-remotely-on-vps-hosting">NETSH rules</a> for one of them. I could probably create BAT script trying to open all ports for all users and that would allow my app with dynamic ports to function as expected, but maybe there is some <strong>Kestrel settings that would make application available on dynamic port without raping Firewall and network settings?</strong></li>
  </ol>