在Prism上为Xamarin.Forms添加客户端DryIoc和IServiceProvider

在Prism上为Xamarin.Forms添加客户端DryIoc和IServiceProvider,xamarin.forms,prism,refit,httpclientfactory,Xamarin.forms,Prism,Refit,Httpclientfactory,我正在尝试遵循,但是我正在为IHttpClientFactory containerRegistry.RegisterServices(services => { services.AddTransient<HttpLoggingHandler>(); services.AddTransient<AuthorizationDelegatingHandler>();

我正在尝试遵循,但是我正在为
IHttpClientFactory

containerRegistry.RegisterServices(services =>
            {
                services.AddTransient<HttpLoggingHandler>();
                services.AddTransient<AuthorizationDelegatingHandler>();

                services.AddRefitClient<IMyApi>()
                    .ConfigureHttpClient(c =>
                        c.BaseAddress =
                            new Uri(apiBaseUrl))
                    .AddHttpMessageHandler<AuthorizationDelegatingHandler>()
                    .AddHttpMessageHandler<HttpLoggingHandler>()
                    .AddTransientHttpErrorPolicy(builder => builder.WaitAndRetryAsync(new[]
                    {
                        TimeSpan.FromMilliseconds(300),
                        TimeSpan.FromSeconds(600),
                        TimeSpan.FromSeconds(800)
                    }))
                    .AddTransientHttpErrorPolicy(
                        p => p.CircuitBreakerAsync(5, TimeSpan.FromSeconds(30)));
            });

我个人必须处理所有这些问题,并最终创建了一个内置身份验证和日志处理程序的地方,从注册表中解析策略,以及许多其他功能,如连接性测试、缓存或优先级排序。如果有帮助的话。

您好,您成功地使它工作了吗?试着做同样的事。
BaseAddress must be set on the HttpClient instance
  at Refit.RequestBuilderImplementation+<>c__DisplayClass14_0`2[T,TBody].<BuildCancellableTaskFuncForMethod>b__0 (System.Net.Http.HttpClient client, System.Threading.CancellationToken ct, System.Object[] paramList) [0x00030] in /_/Refit/RequestBuilderImplementation.cs:236