title: Need to get site URL in ConfigureServices method of Startup.cs
body: <p>I'm using ASP.NET Core MVC 2.2 and I need to get the current URL of the website in the ConfigureServices method of Startup.cs.</p>
  
  <p>This is because the URL is passed into the constructor of a library that I am configuring in that method.</p>
  
  <pre><code>services.AddScoped&lt;IEmailProvider&gt;(ep =&gt; new SendGridEmailProvider(Configuration["Email:SendGridApiKey"],
                  Configuration.GetValue&lt;bool&gt;("Email:TestMode", true), 
                  Configuration["Email:TestModeEmailAddresses"],
                  Configuration["ENVIRONMENT"], 
                  "THIS SHOULD BE THE APPLICATION URL"));
  </code></pre>
  
  <p>I'm pretty sure that I can't use standard dependency injection techniques within ConfigureServices as this is where all the dependency injection is actually set up!</p>
  
  <p>Is there some way of getting the current URL of the request? I just need the base URL like www.site.com.</p>