HttpClientFactoryServiceCollectionExtensions.AddHttpClient HttpClientFactoryServiceCollectionExtensions.AddHttpClient HttpClientFactoryServiceCollectionExtensions.AddHttpClient HttpClientFactoryServiceCollectionExtensions.AddHttpClient Method

Definition

Overloads

AddHttpClient(IServiceCollection) AddHttpClient(IServiceCollection) AddHttpClient(IServiceCollection) AddHttpClient(IServiceCollection)

Adds the IHttpClientFactory and related services to the IServiceCollection.

AddHttpClient(IServiceCollection, String) AddHttpClient(IServiceCollection, String) AddHttpClient(IServiceCollection, String) AddHttpClient(IServiceCollection, String)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

AddHttpClient(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient(IServiceCollection, String, Action<IServiceProvider,HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

AddHttpClient(IServiceCollection, String, Action<HttpClient>) AddHttpClient(IServiceCollection, String, Action<HttpClient>) AddHttpClient(IServiceCollection, String, Action<HttpClient>) AddHttpClient(IServiceCollection, String, Action<HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection) AddHttpClient<TClient,TImplementation>(IServiceCollection) AddHttpClient<TClient,TImplementation>(IServiceCollection) AddHttpClient<TClient,TImplementation>(IServiceCollection)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<IServiceProvider,HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection, String) AddHttpClient<TClient,TImplementation>(IServiceCollection, String) AddHttpClient<TClient,TImplementation>(IServiceCollection, String) AddHttpClient<TClient,TImplementation>(IServiceCollection, String)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<IServiceProvider,HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

AddHttpClient<TClient>(IServiceCollection) AddHttpClient<TClient>(IServiceCollection) AddHttpClient<TClient>(IServiceCollection) AddHttpClient<TClient>(IServiceCollection)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the full name of TClient.

AddHttpClient<TClient>(IServiceCollection, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient>(IServiceCollection, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient>(IServiceCollection, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient>(IServiceCollection, Action<IServiceProvider,HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

AddHttpClient<TClient>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, Action<HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

AddHttpClient<TClient>(IServiceCollection, String) AddHttpClient<TClient>(IServiceCollection, String) AddHttpClient<TClient>(IServiceCollection, String) AddHttpClient<TClient>(IServiceCollection, String)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

AddHttpClient<TClient>(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient>(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient>(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient>(IServiceCollection, String, Action<IServiceProvider,HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

AddHttpClient<TClient>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, String, Action<HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

AddHttpClient(IServiceCollection) AddHttpClient(IServiceCollection) AddHttpClient(IServiceCollection) AddHttpClient(IServiceCollection)

Adds the IHttpClientFactory and related services to the IServiceCollection.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddHttpClient (this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddHttpClient (services As IServiceCollection) As IServiceCollection

Parameters

Returns

AddHttpClient(IServiceCollection, String) AddHttpClient(IServiceCollection, String) AddHttpClient(IServiceCollection, String) AddHttpClient(IServiceCollection, String)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::String ^ name);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string name);
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * string -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
<Extension()>
Public Function AddHttpClient (services As IServiceCollection, name As String) As IHttpClientBuilder

Parameters

name
String String String String

The logical name of the HttpClient to configure.

Returns

Remarks

HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

Use DefaultName as the name to configure the default client.

AddHttpClient(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient(IServiceCollection, String, Action<IServiceProvider,HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::String ^ name, Action<IServiceProvider ^, System::Net::Http::HttpClient ^> ^ configureClient);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string name, Action<IServiceProvider,System.Net.Http.HttpClient> configureClient);
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Action<IServiceProvider, System.Net.Http.HttpClient> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
<Extension()>
Public Function AddHttpClient (services As IServiceCollection, name As String, configureClient As Action(Of IServiceProvider, HttpClient)) As IHttpClientBuilder

Parameters

name
String String String String

The logical name of the HttpClient to configure.

configureClient
Action<IServiceProvider,HttpClient>

A delegate that is used to configure an HttpClient.

Returns

Remarks

HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

Use DefaultName as the name to configure the default client.

AddHttpClient(IServiceCollection, String, Action<HttpClient>) AddHttpClient(IServiceCollection, String, Action<HttpClient>) AddHttpClient(IServiceCollection, String, Action<HttpClient>) AddHttpClient(IServiceCollection, String, Action<HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::String ^ name, Action<System::Net::Http::HttpClient ^> ^ configureClient);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string name, Action<System.Net.Http.HttpClient> configureClient);
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Action<System.Net.Http.HttpClient> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
<Extension()>
Public Function AddHttpClient (services As IServiceCollection, name As String, configureClient As Action(Of HttpClient)) As IHttpClientBuilder

Parameters

name
String String String String

The logical name of the HttpClient to configure.

configureClient
Action<HttpClient>

A delegate that is used to configure an HttpClient.

Returns

Remarks

HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

Use DefaultName as the name to configure the default client.

AddHttpClient<TClient,TImplementation>(IServiceCollection) AddHttpClient<TClient,TImplementation>(IServiceCollection) AddHttpClient<TClient,TImplementation>(IServiceCollection) AddHttpClient<TClient,TImplementation>(IServiceCollection)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

public:
generic <typename TClient, typename TImplementation>
 where TClient : class where TImplementation : class, TClient[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TClient : class where TImplementation : class, TClient;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class, TImplementation As Class) (services As IServiceCollection) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. They type specified will be registered in the service collection as a transient service. See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

The implementation type of the typed client. They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parameters

Returns

Remarks

HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<IServiceProvider,HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

public:
generic <typename TClient, typename TImplementation>
 where TClient : class where TImplementation : class, TClient[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Action<IServiceProvider ^, System::Net::Http::HttpClient ^> ^ configureClient);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<IServiceProvider,System.Net.Http.HttpClient> configureClient) where TClient : class where TImplementation : class, TClient;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<IServiceProvider, System.Net.Http.HttpClient> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class, TImplementation As Class) (services As IServiceCollection, configureClient As Action(Of IServiceProvider, HttpClient)) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. They type specified will be registered in the service collection as a transient service. See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

The implementation type of the typed client. They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parameters

configureClient
Action<IServiceProvider,HttpClient>

A delegate that is used to configure an HttpClient.

Returns

Remarks

HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, Action<HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

public:
generic <typename TClient, typename TImplementation>
 where TClient : class where TImplementation : class, TClient[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Action<System::Net::Http::HttpClient ^> ^ configureClient);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<System.Net.Http.HttpClient> configureClient) where TClient : class where TImplementation : class, TClient;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<System.Net.Http.HttpClient> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class, TImplementation As Class) (services As IServiceCollection, configureClient As Action(Of HttpClient)) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. They type specified will be registered in the service collection as a transient service. See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

The implementation type of the typed client. They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parameters

configureClient
Action<HttpClient>

A delegate that is used to configure an HttpClient.

Returns

Remarks

HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

AddHttpClient<TClient,TImplementation>(IServiceCollection, String) AddHttpClient<TClient,TImplementation>(IServiceCollection, String) AddHttpClient<TClient,TImplementation>(IServiceCollection, String) AddHttpClient<TClient,TImplementation>(IServiceCollection, String)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

public:
generic <typename TClient, typename TImplementation>
 where TClient : class where TImplementation : class, TClient[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::String ^ name);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string name) where TClient : class where TImplementation : class, TClient;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * string -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class, TImplementation As Class) (services As IServiceCollection, name As String) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. They type specified will be registered in the service collection as a transient service. See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

The implementation type of the typed client. They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parameters

name
String String String String

The logical name of the HttpClient to configure.

Returns

Remarks

HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

Use DefaultName as the name to configure the default client.

AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<IServiceProvider,HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

public:
generic <typename TClient, typename TImplementation>
 where TClient : class where TImplementation : class, TClient[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::String ^ name, Action<IServiceProvider ^, System::Net::Http::HttpClient ^> ^ configureClient);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string name, Action<IServiceProvider,System.Net.Http.HttpClient> configureClient) where TClient : class where TImplementation : class, TClient;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Action<IServiceProvider, System.Net.Http.HttpClient> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class, TImplementation As Class) (services As IServiceCollection, name As String, configureClient As Action(Of IServiceProvider, HttpClient)) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. They type specified will be registered in the service collection as a transient service. See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

The implementation type of the typed client. They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parameters

name
String String String String

The logical name of the HttpClient to configure.

configureClient
Action<IServiceProvider,HttpClient>

A delegate that is used to configure an HttpClient.

Returns

Remarks

HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

Use DefaultName as the name to configure the default client.

AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient,TImplementation>(IServiceCollection, String, Action<HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

public:
generic <typename TClient, typename TImplementation>
 where TClient : class where TImplementation : class, TClient[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::String ^ name, Action<System::Net::Http::HttpClient ^> ^ configureClient);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string name, Action<System.Net.Http.HttpClient> configureClient) where TClient : class where TImplementation : class, TClient;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Action<System.Net.Http.HttpClient> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class, TImplementation As Class) (services As IServiceCollection, name As String, configureClient As Action(Of HttpClient)) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. They type specified will be registered in the service collection as a transient service. See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

The implementation type of the typed client. They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parameters

name
String String String String

The logical name of the HttpClient to configure.

configureClient
Action<HttpClient>

A delegate that is used to configure an HttpClient.

Returns

Remarks

HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

Use DefaultName as the name to configure the default client.

AddHttpClient<TClient>(IServiceCollection) AddHttpClient<TClient>(IServiceCollection) AddHttpClient<TClient>(IServiceCollection) AddHttpClient<TClient>(IServiceCollection)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the full name of TClient.

public:
generic <typename TClient>
 where TClient : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services) where TClient : class;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class) (services As IServiceCollection) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. They type specified will be registered in the service collection as a transient service. See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Parameters

Returns

Remarks

HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

AddHttpClient<TClient>(IServiceCollection, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient>(IServiceCollection, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient>(IServiceCollection, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient>(IServiceCollection, Action<IServiceProvider,HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

public:
generic <typename TClient>
 where TClient : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Action<IServiceProvider ^, System::Net::Http::HttpClient ^> ^ configureClient);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<IServiceProvider,System.Net.Http.HttpClient> configureClient) where TClient : class;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<IServiceProvider, System.Net.Http.HttpClient> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class) (services As IServiceCollection, configureClient As Action(Of IServiceProvider, HttpClient)) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. They type specified will be registered in the service collection as a transient service. See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Parameters

configureClient
Action<IServiceProvider,HttpClient>

A delegate that is used to configure an HttpClient.

Returns

Remarks

HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

AddHttpClient<TClient>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, Action<HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. The client name will be set to the type name of TClient.

public:
generic <typename TClient>
 where TClient : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Action<System::Net::Http::HttpClient ^> ^ configureClient);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<System.Net.Http.HttpClient> configureClient) where TClient : class;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<System.Net.Http.HttpClient> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class) (services As IServiceCollection, configureClient As Action(Of HttpClient)) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. They type specified will be registered in the service collection as a transient service. See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Parameters

configureClient
Action<HttpClient>

A delegate that is used to configure an HttpClient.

Returns

Remarks

HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

AddHttpClient<TClient>(IServiceCollection, String) AddHttpClient<TClient>(IServiceCollection, String) AddHttpClient<TClient>(IServiceCollection, String) AddHttpClient<TClient>(IServiceCollection, String)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

public:
generic <typename TClient>
 where TClient : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::String ^ name);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string name) where TClient : class;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * string -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class) (services As IServiceCollection, name As String) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. They type specified will be registered in the service collection as a transient service. See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Parameters

name
String String String String

The logical name of the HttpClient to configure.

Returns

Remarks

HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

Use DefaultName as the name to configure the default client.

AddHttpClient<TClient>(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient>(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient>(IServiceCollection, String, Action<IServiceProvider,HttpClient>) AddHttpClient<TClient>(IServiceCollection, String, Action<IServiceProvider,HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

public:
generic <typename TClient>
 where TClient : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::String ^ name, Action<IServiceProvider ^, System::Net::Http::HttpClient ^> ^ configureClient);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string name, Action<IServiceProvider,System.Net.Http.HttpClient> configureClient) where TClient : class;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Action<IServiceProvider, System.Net.Http.HttpClient> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class) (services As IServiceCollection, name As String, configureClient As Action(Of IServiceProvider, HttpClient)) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. They type specified will be registered in the service collection as a transient service. See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Parameters

name
String String String String

The logical name of the HttpClient to configure.

configureClient
Action<IServiceProvider,HttpClient>

A delegate that is used to configure an HttpClient.

Returns

Remarks

HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

Use DefaultName as the name to configure the default client.

AddHttpClient<TClient>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, String, Action<HttpClient>) AddHttpClient<TClient>(IServiceCollection, String, Action<HttpClient>)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

public:
generic <typename TClient>
 where TClient : class[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ AddHttpClient(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, System::String ^ name, Action<System::Net::Http::HttpClient ^> ^ configureClient);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string name, Action<System.Net.Http.HttpClient> configureClient) where TClient : class;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Action<System.Net.Http.HttpClient> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class) (services As IServiceCollection, name As String, configureClient As Action(Of HttpClient)) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. They type specified will be registered in the service collection as a transient service. See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Parameters

name
String String String String

The logical name of the HttpClient to configure.

configureClient
Action<HttpClient>

A delegate that is used to configure an HttpClient.

Returns

Remarks

HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

Use DefaultName as the name to configure the default client.

Applies to