title: Asp.net core HttpsRedirectionMiddleware Failed to determine the https port for redirect
body: <p>I am trying to host an ASP.net Core Web Application in a windows service. I am able to create a self contained deployment and created the windows service. My web application is configured to have port 5000 for http and 5001 for https. Within the application , I use a HttpsRedirectMiddleware.</p>
  
  <p>When I start the windows service , it is only possible to browse the web page over http and throws following error from the Https redirect middleware.</p>
  
  <blockquote>
    <p>Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware Failed to
    determine the https port for redirect.</p>
  </blockquote>
  
  <p>Is there any extra configuration needed to expose a port for https communication?</p>
  
  <p><a href="https://github.com/aspnet/Docs/tree/master/aspnetcore/host-and-deploy/windows-service/samples/2.x/AspNetCoreService" rel="noreferrer">Github Code Sample</a></p>