HttpClientFactoryServiceCollectionExtensions.AddHttpClient Méthode

Définition

Surcharges

AddHttpClient(IServiceCollection)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection.Adds the IHttpClientFactory and related services to the IServiceCollection.

AddHttpClient(IServiceCollection, String)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

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

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

AddHttpClient(IServiceCollection, String, Action<HttpClient>)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. Le nom du client est défini sur le nom de type de TClient.The client name will be set to the type name of TClient.

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

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. Le nom du client est défini sur le nom de type de TClient.The client name will be set to the type name of TClient.

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

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. Le nom du client est défini sur le nom de type de TClient.The client name will be set to the type name of TClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection, String)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. Le nom du client est défini sur le nom de type de TClient.The client name will be set to the type name of TClient.

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

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.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>)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

AddHttpClient<TClient>(IServiceCollection)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. Le nom du client est défini sur le nom complet de TClient.The client name will be set to the full name of TClient.

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

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. Le nom du client est défini sur le nom de type de TClient.The client name will be set to the type name of TClient.

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

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. Le nom du client est défini sur le nom de type de TClient.The client name will be set to the type name of TClient.

AddHttpClient<TClient>(IServiceCollection, String)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.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>)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.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>)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

AddHttpClient(IServiceCollection)

Ajoute IHttpClientFactory et les services connexes au 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

Paramètres

Retours

AddHttpClient(IServiceCollection, String)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure un HttpClient nommé.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

Paramètres

name
String

Nom logique du HttpClient à configurer.The logical name of the HttpClient to configure.

Retours

IHttpClientBuilder qui peut être utilisé pour configurer le client.An IHttpClientBuilder that can be used to configure the client.

Remarques

les instances HttpClient qui appliquent la configuration fournie peuvent être récupérées à l’aide de CreateClient(String) et en fournissant le nom correspondant. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

Utilisez DefaultName comme nom pour configurer le client par défaut.Use DefaultName as the name to configure the default client.

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

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure un HttpClient nommé.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

Paramètres

name
String

Nom logique du HttpClient à configurer.The logical name of the HttpClient to configure.

configureClient
Action<IServiceProvider,HttpClient>

Délégué utilisé pour configurer un HttpClient.A delegate that is used to configure an HttpClient.

Retours

IHttpClientBuilder qui peut être utilisé pour configurer le client.An IHttpClientBuilder that can be used to configure the client.

Remarques

les instances HttpClient qui appliquent la configuration fournie peuvent être récupérées à l’aide de CreateClient(String) et en fournissant le nom correspondant. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

Utilisez DefaultName comme nom pour configurer le client par défaut.Use DefaultName as the name to configure the default client.

AddHttpClient(IServiceCollection, String, Action<HttpClient>)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure un HttpClient nommé.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

Paramètres

name
String

Nom logique du HttpClient à configurer.The logical name of the HttpClient to configure.

configureClient
Action<HttpClient>

Délégué utilisé pour configurer un HttpClient.A delegate that is used to configure an HttpClient.

Retours

IHttpClientBuilder qui peut être utilisé pour configurer le client.An IHttpClientBuilder that can be used to configure the client.

Remarques

les instances HttpClient qui appliquent la configuration fournie peuvent être récupérées à l’aide de CreateClient(String) et en fournissant le nom correspondant. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

Utilisez DefaultName comme nom pour configurer le client par défaut.Use DefaultName as the name to configure the default client.

AddHttpClient<TClient,TImplementation>(IServiceCollection)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. Le nom du client est défini sur le nom de type de TClient.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

Paramètres de type

TClient

Type du client typé.The type of the typed client. Ils doivent être inscrits dans la collection de services en tant que service temporaire.They type specified will be registered in the service collection as a transient service. Pour plus d’informations sur la création de clients typés, consultez ITypedHttpClientFactory<TClient>.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

Type d’implémentation du client typé.The implementation type of the typed client. Ils doivent être instanciés par le ITypedHttpClientFactory<TClient>They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Paramètres

Retours

IHttpClientBuilder qui peut être utilisé pour configurer le client.An IHttpClientBuilder that can be used to configure the client.

Remarques

les instances HttpClient qui appliquent la configuration fournie peuvent être récupérées à l’aide de CreateClient(String) et en fournissant le nom correspondant. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

les instances TClient construites avec le HttpClient approprié peuvent être récupérées à partir de GetService(Type) (et des méthodes associées) en fournissant TClient comme type de service. 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>)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. Le nom du client est défini sur le nom de type de TClient.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

Paramètres de type

TClient

Type du client typé.The type of the typed client. Ils doivent être inscrits dans la collection de services en tant que service temporaire.They type specified will be registered in the service collection as a transient service. Pour plus d’informations sur la création de clients typés, consultez ITypedHttpClientFactory<TClient>.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

Type d’implémentation du client typé.The implementation type of the typed client. Ils doivent être instanciés par le ITypedHttpClientFactory<TClient>They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Paramètres

configureClient
Action<IServiceProvider,HttpClient>

Délégué utilisé pour configurer un HttpClient.A delegate that is used to configure an HttpClient.

Retours

IHttpClientBuilder qui peut être utilisé pour configurer le client.An IHttpClientBuilder that can be used to configure the client.

Remarques

les instances HttpClient qui appliquent la configuration fournie peuvent être récupérées à l’aide de CreateClient(String) et en fournissant le nom correspondant. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

les instances TClient construites avec le HttpClient approprié peuvent être récupérées à partir de GetService(Type) (et des méthodes associées) en fournissant TClient comme type de service. 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>)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. Le nom du client est défini sur le nom de type de TClient.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

Paramètres de type

TClient

Type du client typé.The type of the typed client. Ils doivent être inscrits dans la collection de services en tant que service temporaire.They type specified will be registered in the service collection as a transient service. Pour plus d’informations sur la création de clients typés, consultez ITypedHttpClientFactory<TClient>.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

Type d’implémentation du client typé.The implementation type of the typed client. Ils doivent être instanciés par le ITypedHttpClientFactory<TClient>They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Paramètres

configureClient
Action<HttpClient>

Délégué utilisé pour configurer un HttpClient.A delegate that is used to configure an HttpClient.

Retours

IHttpClientBuilder qui peut être utilisé pour configurer le client.An IHttpClientBuilder that can be used to configure the client.

Remarques

les instances HttpClient qui appliquent la configuration fournie peuvent être récupérées à l’aide de CreateClient(String) et en fournissant le nom correspondant. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

les instances TClient construites avec le HttpClient approprié peuvent être récupérées à partir de GetService(Type) (et des méthodes associées) en fournissant TClient comme type de service. 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)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. Le nom du client est défini sur le nom de type de TClient.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

Paramètres de type

TClient

Type du client typé.The type of the typed client. Ils doivent être inscrits dans la collection de services en tant que service temporaire.They type specified will be registered in the service collection as a transient service. Pour plus d’informations sur la création de clients typés, consultez ITypedHttpClientFactory<TClient>.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

Type d’implémentation du client typé.The implementation type of the typed client. Ils doivent être instanciés par le ITypedHttpClientFactory<TClient>They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Paramètres

name
String

Nom logique du HttpClient à configurer.The logical name of the HttpClient to configure.

Retours

IHttpClientBuilder qui peut être utilisé pour configurer le client.An IHttpClientBuilder that can be used to configure the client.

Remarques

les instances HttpClient qui appliquent la configuration fournie peuvent être récupérées à l’aide de CreateClient(String) et en fournissant le nom correspondant. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

les instances TClient construites avec le HttpClient approprié peuvent être récupérées à partir de GetService(Type) (et des méthodes associées) en fournissant TClient comme type de service. TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

Utilisez DefaultName comme nom pour configurer le client par défaut.Use DefaultName as the name to configure the default client.

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

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.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

Paramètres de type

TClient

Type du client typé.The type of the typed client. Ils doivent être inscrits dans la collection de services en tant que service temporaire.They type specified will be registered in the service collection as a transient service. Pour plus d’informations sur la création de clients typés, consultez ITypedHttpClientFactory<TClient>.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

Type d’implémentation du client typé.The implementation type of the typed client. Ils doivent être instanciés par le ITypedHttpClientFactory<TClient>They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Paramètres

name
String

Nom logique du HttpClient à configurer.The logical name of the HttpClient to configure.

configureClient
Action<IServiceProvider,HttpClient>

Délégué utilisé pour configurer un HttpClient.A delegate that is used to configure an HttpClient.

Retours

IHttpClientBuilder qui peut être utilisé pour configurer le client.An IHttpClientBuilder that can be used to configure the client.

Remarques

les instances HttpClient qui appliquent la configuration fournie peuvent être récupérées à l’aide de CreateClient(String) et en fournissant le nom correspondant. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

les instances TClient construites avec le HttpClient approprié peuvent être récupérées à partir de GetService(Type) (et des méthodes associées) en fournissant TClient comme type de service. TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

Utilisez DefaultName comme nom pour configurer le client par défaut.Use DefaultName as the name to configure the default client.

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

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.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

Paramètres de type

TClient

Type du client typé.The type of the typed client. Ils doivent être inscrits dans la collection de services en tant que service temporaire.They type specified will be registered in the service collection as a transient service. Pour plus d’informations sur la création de clients typés, consultez ITypedHttpClientFactory<TClient>.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

Type d’implémentation du client typé.The implementation type of the typed client. Ils doivent être instanciés par le ITypedHttpClientFactory<TClient>They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Paramètres

name
String

Nom logique du HttpClient à configurer.The logical name of the HttpClient to configure.

configureClient
Action<HttpClient>

Délégué utilisé pour configurer un HttpClient.A delegate that is used to configure an HttpClient.

Retours

IHttpClientBuilder qui peut être utilisé pour configurer le client.An IHttpClientBuilder that can be used to configure the client.

Remarques

les instances HttpClient qui appliquent la configuration fournie peuvent être récupérées à l’aide de CreateClient(String) et en fournissant le nom correspondant. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

les instances TClient construites avec le HttpClient approprié peuvent être récupérées à partir de GetService(Type) (et des méthodes associées) en fournissant TClient comme type de service. TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

Utilisez DefaultName comme nom pour configurer le client par défaut.Use DefaultName as the name to configure the default client.

AddHttpClient<TClient>(IServiceCollection)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. Le nom du client est défini sur le nom complet de TClient.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

Paramètres de type

TClient

Type du client typé.The type of the typed client. Ils doivent être inscrits dans la collection de services en tant que service temporaire.They type specified will be registered in the service collection as a transient service. Pour plus d’informations sur la création de clients typés, consultez ITypedHttpClientFactory<TClient>.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Paramètres

Retours

IHttpClientBuilder qui peut être utilisé pour configurer le client.An IHttpClientBuilder that can be used to configure the client.

Remarques

les instances HttpClient qui appliquent la configuration fournie peuvent être récupérées à l’aide de CreateClient(String) et en fournissant le nom correspondant. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

les instances TClient construites avec le HttpClient approprié peuvent être récupérées à partir de GetService(Type) (et des méthodes associées) en fournissant TClient comme type de service. 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>)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. Le nom du client est défini sur le nom de type de TClient.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

Paramètres de type

TClient

Type du client typé.The type of the typed client. Ils doivent être inscrits dans la collection de services en tant que service temporaire.They type specified will be registered in the service collection as a transient service. Pour plus d’informations sur la création de clients typés, consultez ITypedHttpClientFactory<TClient>.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Paramètres

configureClient
Action<IServiceProvider,HttpClient>

Délégué utilisé pour configurer un HttpClient.A delegate that is used to configure an HttpClient.

Retours

IHttpClientBuilder qui peut être utilisé pour configurer le client.An IHttpClientBuilder that can be used to configure the client.

Remarques

les instances HttpClient qui appliquent la configuration fournie peuvent être récupérées à l’aide de CreateClient(String) et en fournissant le nom correspondant. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

les instances TClient construites avec le HttpClient approprié peuvent être récupérées à partir de GetService(Type) (et des méthodes associées) en fournissant TClient comme type de service. 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>)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. Le nom du client est défini sur le nom de type de TClient.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

Paramètres de type

TClient

Type du client typé.The type of the typed client. Ils doivent être inscrits dans la collection de services en tant que service temporaire.They type specified will be registered in the service collection as a transient service. Pour plus d’informations sur la création de clients typés, consultez ITypedHttpClientFactory<TClient>.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Paramètres

configureClient
Action<HttpClient>

Délégué utilisé pour configurer un HttpClient.A delegate that is used to configure an HttpClient.

Retours

IHttpClientBuilder qui peut être utilisé pour configurer le client.An IHttpClientBuilder that can be used to configure the client.

Remarques

les instances HttpClient qui appliquent la configuration fournie peuvent être récupérées à l’aide de CreateClient(String) et en fournissant le nom correspondant. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

les instances TClient construites avec le HttpClient approprié peuvent être récupérées à partir de GetService(Type) (et des méthodes associées) en fournissant TClient comme type de service. 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)

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.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

Paramètres de type

TClient

Type du client typé.The type of the typed client. Ils doivent être inscrits dans la collection de services en tant que service temporaire.They type specified will be registered in the service collection as a transient service. Pour plus d’informations sur la création de clients typés, consultez ITypedHttpClientFactory<TClient>.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Paramètres

name
String

Nom logique du HttpClient à configurer.The logical name of the HttpClient to configure.

Retours

IHttpClientBuilder qui peut être utilisé pour configurer le client.An IHttpClientBuilder that can be used to configure the client.

Remarques

les instances HttpClient qui appliquent la configuration fournie peuvent être récupérées à l’aide de CreateClient(String) et en fournissant le nom correspondant. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

les instances TClient construites avec le HttpClient approprié peuvent être récupérées à partir de GetService(Type) (et des méthodes associées) en fournissant TClient comme type de service. TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

Utilisez DefaultName comme nom pour configurer le client par défaut.Use DefaultName as the name to configure the default client.

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

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.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

Paramètres de type

TClient

Type du client typé.The type of the typed client. Ils doivent être inscrits dans la collection de services en tant que service temporaire.They type specified will be registered in the service collection as a transient service. Pour plus d’informations sur la création de clients typés, consultez ITypedHttpClientFactory<TClient>.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Paramètres

name
String

Nom logique du HttpClient à configurer.The logical name of the HttpClient to configure.

configureClient
Action<IServiceProvider,HttpClient>

Délégué utilisé pour configurer un HttpClient.A delegate that is used to configure an HttpClient.

Retours

IHttpClientBuilder qui peut être utilisé pour configurer le client.An IHttpClientBuilder that can be used to configure the client.

Remarques

les instances HttpClient qui appliquent la configuration fournie peuvent être récupérées à l’aide de CreateClient(String) et en fournissant le nom correspondant. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

les instances TClient construites avec le HttpClient approprié peuvent être récupérées à partir de GetService(Type) (et des méthodes associées) en fournissant TClient comme type de service. TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

Utilisez DefaultName comme nom pour configurer le client par défaut.Use DefaultName as the name to configure the default client.

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

Ajoute IHttpClientFactory et les services connexes au IServiceCollection, et configure une liaison entre le type TClient et un HttpClient nommé.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

Paramètres de type

TClient

Type du client typé.The type of the typed client. Ils doivent être inscrits dans la collection de services en tant que service temporaire.They type specified will be registered in the service collection as a transient service. Pour plus d’informations sur la création de clients typés, consultez ITypedHttpClientFactory<TClient>.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Paramètres

name
String

Nom logique du HttpClient à configurer.The logical name of the HttpClient to configure.

configureClient
Action<HttpClient>

Délégué utilisé pour configurer un HttpClient.A delegate that is used to configure an HttpClient.

Retours

IHttpClientBuilder qui peut être utilisé pour configurer le client.An IHttpClientBuilder that can be used to configure the client.

Remarques

les instances HttpClient qui appliquent la configuration fournie peuvent être récupérées à l’aide de CreateClient(String) et en fournissant le nom correspondant. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

les instances TClient construites avec le HttpClient approprié peuvent être récupérées à partir de GetService(Type) (et des méthodes associées) en fournissant TClient comme type de service. TClient instances constructed with the appropriate HttpClient can be retrieved from GetService(Type) (and related methods) by providing TClient as the service type.

Utilisez DefaultName comme nom pour configurer le client par défaut.Use DefaultName as the name to configure the default client.

S’applique à