다음을 통해 공유


HttpClientFactoryServiceCollectionExtensions.AddHttpClient Method

Definition

Overloads

AddHttpClient(IServiceCollection)

Adds the IHttpClientFactory and related services to the IServiceCollection.

AddHttpClient(IServiceCollection, String)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named 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>)

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

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

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>)

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<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)

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, Func<HttpClient,TImplementation>)

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, Func<HttpClient,IServiceProvider,TImplementation>)

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, 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)

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, Func<HttpClient,TImplementation>)

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, 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, 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, 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)

Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named 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, 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)

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(IServiceCollection)

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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

The IServiceCollection.

Applies to

AddHttpClient(IServiceCollection, String)

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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

The logical name of the HttpClient to configure.

Returns

An IHttpClientBuilder that can be used to configure the client.

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.

Applies to

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

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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

The logical name of the HttpClient to configure.

configureClient
Action<IServiceProvider,HttpClient>

A delegate that is used to configure an HttpClient.

Returns

An IHttpClientBuilder that can be used to configure the client.

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.

Applies to

AddHttpClient(IServiceCollection, String, Action<HttpClient>)

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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

The logical name of the HttpClient to configure.

configureClient
Action<HttpClient>

A delegate that is used to configure an HttpClient.

Returns

An IHttpClientBuilder that can be used to configure the client.

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.

Applies to

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

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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, Func<System::Net::Http::HttpClient ^, IServiceProvider ^, TImplementation> ^ factory);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string name, Func<System.Net.Http.HttpClient,IServiceProvider,TImplementation> factory) where TClient : class where TImplementation : class, TClient;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Func<System.Net.Http.HttpClient, IServiceProvider, #'Client> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class, TImplementation As Class) (services As IServiceCollection, name As String, factory As Func(Of HttpClient, IServiceProvider, TImplementation)) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. The 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.

Parameters

name
String

The logical name of the HttpClient to configure.

factory
Func<HttpClient,IServiceProvider,TImplementation>

A delegate that is used to create an instance of TClient.

Returns

An IHttpClientBuilder that can be used to configure the client.

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.

Applies to

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

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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. The 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. The type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parameters

name
String

The logical name of the HttpClient to configure.

configureClient
Action<HttpClient>

A delegate that is used to configure an HttpClient.

Returns

An IHttpClientBuilder that can be used to configure the client.

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

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

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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. The 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. The type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parameters

name
String

The logical name of the HttpClient to configure.

configureClient
Action<IServiceProvider,HttpClient>

A delegate that is used to configure an HttpClient.

Returns

An IHttpClientBuilder that can be used to configure the client.

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

AddHttpClient<TClient,TImplementation>(IServiceCollection, String)

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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);
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. The 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. The type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parameters

name
String

The logical name of the HttpClient to configure.

Returns

An IHttpClientBuilder that can be used to configure the client.

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

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

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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, Func<System::Net::Http::HttpClient ^, TImplementation> ^ factory);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<System.Net.Http.HttpClient,TImplementation> factory) where TClient : class where TImplementation : class, TClient;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Func<System.Net.Http.HttpClient, #'Client> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class, TImplementation As Class) (services As IServiceCollection, factory As Func(Of HttpClient, TImplementation)) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. The 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.

Parameters

factory
Func<HttpClient,TImplementation>

A delegate that is used to create an instance of TClient.

Returns

An IHttpClientBuilder that can be used to configure the client.

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.

Applies to

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

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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, Func<System::Net::Http::HttpClient ^, IServiceProvider ^, TImplementation> ^ factory);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Func<System.Net.Http.HttpClient,IServiceProvider,TImplementation> factory) where TClient : class where TImplementation : class, TClient;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * Func<System.Net.Http.HttpClient, IServiceProvider, #'Client> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class, TImplementation As Class) (services As IServiceCollection, factory As Func(Of HttpClient, IServiceProvider, TImplementation)) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. The 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.

Parameters

factory
Func<HttpClient,IServiceProvider,TImplementation>

A delegate that is used to create an instance of TClient.

Returns

An IHttpClientBuilder that can be used to configure the client.

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.

Applies to

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

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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. The 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. The type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parameters

configureClient
Action<HttpClient>

A delegate that is used to configure an HttpClient.

Returns

An IHttpClientBuilder that can be used to configure the client.

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.

Applies to

AddHttpClient<TClient,TImplementation>(IServiceCollection)

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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. The 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. The type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parameters

Returns

An IHttpClientBuilder that can be used to configure the client.

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.

Applies to

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

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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, Func<System::Net::Http::HttpClient ^, TImplementation> ^ factory);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddHttpClient<TClient,TImplementation> (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, string name, Func<System.Net.Http.HttpClient,TImplementation> factory) where TClient : class where TImplementation : class, TClient;
static member AddHttpClient : Microsoft.Extensions.DependencyInjection.IServiceCollection * string * Func<System.Net.Http.HttpClient, #'Client> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder (requires 'Client : null)
<Extension()>
Public Function AddHttpClient(Of TClient As Class, TImplementation As Class) (services As IServiceCollection, name As String, factory As Func(Of HttpClient, TImplementation)) As IHttpClientBuilder

Type Parameters

TClient

The type of the typed client. The 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.

Parameters

name
String

The logical name of the HttpClient to configure.

factory
Func<HttpClient,TImplementation>

A delegate that is used to create an instance of TClient.

Returns

An IHttpClientBuilder that can be used to configure the client.

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.

TImplementation

Applies to

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

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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. The 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. The type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parameters

configureClient
Action<IServiceProvider,HttpClient>

A delegate that is used to configure an HttpClient.

Returns

An IHttpClientBuilder that can be used to configure the client.

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.

Applies to

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

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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. The 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

The logical name of the HttpClient to configure.

configureClient
Action<HttpClient>

A delegate that is used to configure an HttpClient.

Returns

An IHttpClientBuilder that can be used to configure the client.

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

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

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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. The 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

The logical name of the HttpClient to configure.

configureClient
Action<IServiceProvider,HttpClient>

A delegate that is used to configure an HttpClient.

Returns

An IHttpClientBuilder that can be used to configure the client.

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

AddHttpClient<TClient>(IServiceCollection, String)

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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. The 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

The logical name of the HttpClient to configure.

Returns

An IHttpClientBuilder that can be used to configure the client.

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

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

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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. The 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

An IHttpClientBuilder that can be used to configure the client.

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.

Applies to

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

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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. The 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

An IHttpClientBuilder that can be used to configure the client.

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.

Applies to

AddHttpClient<TClient>(IServiceCollection)

Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs
Source:
HttpClientFactoryServiceCollectionExtensions.cs

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);
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. The 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

An IHttpClientBuilder that can be used to configure the client.

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.

Applies to