title: Why does Kestrel fail to start when certificates are present?
body: <p>I have Apache 2.4 as a reverse proxy with Kestrel on Windows Server 2019. I have one app already running on the server. I set up a second app with its own <code>appname.conf</code> file in <code>C:\Apache24\conf\sites-enabled</code> and added new, unexpired SSL certificate files to <code>C:\Apache24\conf\ssl\appname</code>. </p>
  
  <p>In the app's <code>Program.cs</code>, this is the <code>CreateHostBuilder</code>, where I've specified the ports to be used so they are different from the first app's:</p>
  
  <pre><code>public static IHostBuilder CreateHostBuilder(string[] args) =&gt;
          Host.CreateDefaultBuilder(args)
              .ConfigureWebHostDefaults(webBuilder =&gt;
              {
                  webBuilder.UseUrls("http://localhost:5002", "https://localhost:5003");
                  webBuilder.UseStartup&lt;Startup&gt;();
              });
  </code></pre>
  
  <p>When running the command to start the app on the server (<code>dotnet appname.dll</code>), I get this error:</p>
  
  <blockquote>
    <p>crit: Microsoft.AspNetCore.Server.Kestrel[0]
          Unable to start Kestrel.
    System.InvalidOperationException: Unable to configure HTTPS endpoint. No server certificate was specified, and the default developer certificate could not be found or is out of date.</p>
    
    <p>To generate a developer certificate run 'dotnet dev-certs https'. To trust the certificate (Windows and macOS only) run 'dotnet dev-certs https --trust'.
    For more information on configuring HTTPS see <a href="https://go.microsoft.com/fwlink/?linkid=848054" rel="nofollow noreferrer">https://go.microsoft.com/fwlink/?linkid=848054</a>.</p>
  </blockquote>
  
  <p>Even though I have the real SSL certificates, I've run <code>dotnet dev-certs https --trust</code>, as the error suggests, even going as far as deleting the certs from the Windows cert manager GUI first, as suggested <a href="https://github.com/aspnet/DotNetTools/issues/464#issuecomment-430327197" rel="nofollow noreferrer">on Github</a>, to no avail.</p>
  
  <p>Any help is greatly appreciated.</p>