We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
//Microsoft.Extensions.Http和Microsoft.Extensions.DependencyInjection ServiceCollection services = new ServiceCollection(); services.AddTransient(typeof(IDisposable), typeof(AuthenticatedParameterizedHttpClientHandler)); services.AddRefitClient<IApiService>(settings) .ConfigureHttpClient(c => { c.BaseAddress = new Uri("http://127.0.0.1/:8080" + "/iLab/"); c.DefaultRequestHeaders.Add("Content-Type", "application/json; charset=UTF-8"); }) .AddHttpMessageHandler<AuthenticatedParameterizedHttpClientHandler>() .SetHandlerLifetime(TimeSpan.FromMinutes(2)); var serviceProvider = services.BuildServiceProvider(); object httpClientFactory = serviceProvider.GetRequiredService(typeof(IApiService));
ServiceCollection services = new ServiceCollection(); services.AddTransient(typeof(IDisposable), typeof(AuthenticatedParameterizedHttpClientHandler)); services.AddRefitClient<IApiService>(settings) .ConfigureHttpClient(c => { c.BaseAddress = new Uri("http://127.0.0.1/:8080" + "/iLab/"); c.DefaultRequestHeaders.Add("Content-Type", "application/json; charset=UTF-8"); }) .AddHttpMessageHandler<AuthenticatedParameterizedHttpClientHandler>() .SetHandlerLifetime(TimeSpan.FromMinutes(2)); var serviceProvider = services.BuildServiceProvider(); object httpClientFactory = serviceProvider.GetRequiredService(typeof(IApiService));
on the above last statement, the exception is thrown. says no type for 'AuthenticatedParameterizedHttpClientHandler' registered
The text was updated successfully, but these errors were encountered:
Your formatted code is:
and as the exception message indicates, your problem is this line:
services.AddTransient(typeof(IDisposable), typeof(AuthenticatedParameterizedHttpClientHandler));
which should be:
services.AddTransient<AuthenticatedParameterizedHttpClientHandler>();
Sorry, something went wrong.
No branches or pull requests
//Microsoft.Extensions.Http和Microsoft.Extensions.DependencyInjection
ServiceCollection services = new ServiceCollection(); services.AddTransient(typeof(IDisposable), typeof(AuthenticatedParameterizedHttpClientHandler)); services.AddRefitClient<IApiService>(settings) .ConfigureHttpClient(c => { c.BaseAddress = new Uri("http://127.0.0.1/:8080" + "/iLab/"); c.DefaultRequestHeaders.Add("Content-Type", "application/json; charset=UTF-8"); }) .AddHttpMessageHandler<AuthenticatedParameterizedHttpClientHandler>() .SetHandlerLifetime(TimeSpan.FromMinutes(2)); var serviceProvider = services.BuildServiceProvider(); object httpClientFactory = serviceProvider.GetRequiredService(typeof(IApiService));
on the above last statement, the exception is thrown. says no type for 'AuthenticatedParameterizedHttpClientHandler' registered
The text was updated successfully, but these errors were encountered: