我正在尝试使用在服务器中配置HttpClient
的基地址,但出现运行时异常:Blazor
IHttpClientFactory
services.AddHttpClient("ApiClient", (provider, client) =>
{
var uriHelper = provider.GetRequiredService<NavigationManager>();
client.BaseAddress = new Uri(uriHelper.BaseUri);
});
System.InvalidOperationException: 'Cannot resolve scoped service 'Microsoft.AspNetCore.Components.NavigationManager' from root provider.'
任何人都知道这里可能是什么问题?