title: httpClientFactory- services AddHttpClient
body: <p>I am having a problem following this guide: <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-2.1#basic-usage" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/core/fundamentals/http-requests?view=aspnetcore-2.1#basic-usage</a></p>
  
  <p>this is my configureservices</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
          {
              services.AddHttpClient();
  
              services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
          }
  </code></pre>
  
  <p>this is my page</p>
  
  <pre><code> public class IndexModel : PageModel
      {
          private readonly IHttpClientFactory httpClientFactory;
  
          public IList&lt;Blog&gt; Blog { get; set; }
  
          public IndexModel(IHttpClientFactory httpClientFactory)
          {
              this.httpClientFactory = httpClientFactory;
          }
  
  
          public async Task OnGetAsync()
          {
  
          }
      }
  </code></pre>
  
  <p>I am receiving following error when browsing to my page:</p>
  
  <pre class="lang-html prettyprint-override"><code>InvalidOperationException: Unable to resolve service for type 'System.Net.Http.IHttpClientFactory' while attempting to activate 'WebApplication1.Pages.Blogs.IndexModel'.
  </code></pre>
  
  <p>am I missing something?
  Thanks for any advice</p>
  
  <p>regards,</p>
  
  <p>foo</p>