title: Resolving service for IHttpClientFactory fails on Azure Function
body: <p>I am trying to inject <code>IHttpClientFactory</code> service on Azure Function v3, but I keep getting the following erorr saying resolving a service failed.
  I use azure-functions-core-tools@v3 to run Azure Function locally.</p>
  
  <pre><code>[2/14/2020 5:45:19 PM] Executed 'Foo' (Failed, Id=24489b3b-af99-417e-b175-443b76c241d5)
  [2/14/2020 5:45:19 PM] Microsoft.Extensions.DependencyInjection.Abstractions: Unable to resolve service for type 'System.Net.Http.IHttpClientFactory' while attempting to activate 'MyFunction.Function.Foo'.
  </code></pre>
  
  <p>I have a startup class that is supposed to inject a service for <code>IHttpClientFactory</code>.</p>
  
  <pre class="lang-cs prettyprint-override"><code>using Microsoft.Azure.Functions.Extensions.DependencyInjection;
  using Microsoft.Extensions.DependencyInjection;
  
  namespace MyFunction
  {
      public class Startup : FunctionsStartup
      {
  
          public override void Configure(IFunctionsHostBuilder builder)
          {
              builder.Services.AddHttpClient();
          }
      }
  }
  </code></pre>
  
  <p>And below is an azure function class that uses injected service of <code>IHttpClientFactory</code> to create a HTTP client and send a GET request to a server.</p>
  
  <pre class="lang-cs prettyprint-override"><code>using System.Threading.Tasks;
  using System.Net.Http;
  using Microsoft.AspNetCore.Mvc;
  using Microsoft.Azure.WebJobs;
  using Microsoft.Azure.WebJobs.Extensions.Http;
  using Microsoft.AspNetCore.Http;
  using Microsoft.Extensions.Logging;
  
  namespace MyFunction.Function
  {
      public class Foo
      {
          private readonly HttpClient httpClient;
          public Scrape(IHttpClientFactory httpClientFactory)
          {
              httpClient = httpClientFactory.CreateClient();
          }
  
          [FunctionName("Foo")]
          public async Task&lt;IActionResult&gt; Run(
              [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
              ILogger log)
          {
              var result = await httpClient.GetAsync("https://google.com");
              var data = await result.Content.ReadAsStringAsync();
              return new OkObjectResult(data);
          }
      }
  }
  </code></pre>
  
  <p>Am I missing something?</p>