title: Getting the Base URL of the application inside of the ASP.NET Core HostedService
body: <p>I need to obtain the base URL of the ASP.NET Core application inside of one of  the HostedServices. </p>
  
  <p>I need this because it does a request to the same ASP.NET core application in which it is hosted (the purpose is warming up, to improve the first call performance to the User). </p>
  
  <p>For now my solution is to keep the base URL in the config file or just in the hosted service private variable. </p>
  
  <p><a href="https://github.com/BBGONE/JRIApp.Core/blob/master/DEMOS/RIAppDemoMVC/RIAppDemo/Utils/WarmUpService.cs" rel="nofollow noreferrer">https://github.com/BBGONE/JRIApp.Core/blob/master/DEMOS/RIAppDemoMVC/RIAppDemo/Utils/WarmUpService.cs</a></p>
  
  <p>But i think, there's a way to obtain it from the startup code, but i don't know where it is hidden.</p>
  
  <p>Anybody know how it can be obtained?</p>
  
  <p>P.S. - there are solutions to obtain it from the request information, but  the HostedService is started before any request have been done. So it's not suitable in this case.</p>