title: Hosting Web API in .Net Core Worker Service - cannot reference IWebHostEnvironment
body: <p>I'm creating a .NET Core Worker Service, and want to expose ASP.Net Core Web APIs for the service. I'm using .NET Core 3.0. 
  Initially, my plan was to replace IHostBuilder with IWebHostBuilder and add a Startup class just like a regular Asp.Net Core web app (this is probably an oversimplification, though). </p>
  
  <p>My plan was to simply try to replace </p>
  
  <pre class="lang-cs prettyprint-override"><code>public static IHostBuilder CreateHostBuilder(string[] args)
          {
              return Host.CreateDefaultBuilder(args)                
                  .ConfigureServices((hostContext, services) =&gt;
                  {
                      services.AddHostedService&lt;Worker&gt;();
                  });
          }
  </code></pre>
  
  <p>with</p>
  
  <pre class="lang-cs prettyprint-override"><code>public static IWebHostBuilder CreateHostBuilder(string[] args)
          {
              return WebHost.CreateDefaultBuilder(args)
                  .ConfigureServices(services =&gt;
                  {
                      services.AddHostedService&lt;Worker&gt;();
                  }).UseStartup&lt;Startup&gt;();            
          }
  </code></pre>
  
  <p>which may not work at all, but at least it's a starting point...
  What's blocking me from trying this approach is that I cannot implement my <code>Startup</code> class because <code>IWebHostEnvironment</code> is unavailable. </p>
  
  <p>Here's my </p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netcoreapp3.0&lt;/TargetFramework&gt;
      &lt;UserSecretsId&gt;dotnet-WorkerServices-0E977A2C-F0C8-49E7-B00A-5EB01B99FBEB&lt;/UserSecretsId&gt;
    &lt;/PropertyGroup&gt;
  
    &lt;ItemGroup&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" /&gt;
      &lt;PackageReference Include="Microsoft.AspNetCore.Hosting.Server.Abstractions" Version="2.2.0" /&gt;
      &lt;PackageReference Include="Microsoft.Extensions.Hosting" Version="3.0.0" /&gt;
      &lt;PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="3.0.0" /&gt;
    &lt;/ItemGroup&gt;
  </code></pre>
  
  <p>As far as I know, <code>IWebHostEnvironment</code> should be in the <code>Microsoft.Extensions.Hosting.Abstractions</code> nuget package, but referencing it does not seem to work.</p>
  
  <p>Does anyone have any ideas?
  -Thanks!</p>