title: How to configure HttpClient base address in Blazor Server using IHttpClientFactory
body: <p>I am trying to configure <code>HttpClient</code> 's base address in a <code>Blazor</code> Server using <code>IHttpClientFactory</code> but I am getting a runtime exception:</p>
  <pre><code>    services.AddHttpClient(&quot;ApiClient&quot;, (provider, client) =&gt;
      {
          var uriHelper = provider.GetRequiredService&lt;NavigationManager&gt;();
          client.BaseAddress = new Uri(uriHelper.BaseUri);
      });
  </code></pre>
  <pre><code>System.InvalidOperationException: 'Cannot resolve scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from root provider.'
  </code></pre>
  <p><a href="https://i.stack.imgur.com/VuK1B.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VuK1B.png" alt="Exception screenshot" /></a></p>
  <p>Anyone know what might be the issue here?</p>