HttpClientFactoryServiceCollectionExtensions.AddHttpClient Método

Definição

Sobrecargas

AddHttpClient(IServiceCollection)

Adiciona o IHttpClientFactory e os serviços relacionados à IServiceCollection.Adds the IHttpClientFactory and related services to the IServiceCollection.

AddHttpClient(IServiceCollection, String)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

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

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

AddHttpClient(IServiceCollection, String, Action<HttpClient>)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a named HttpClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. O nome do cliente será definido como o nome do tipo de TClient.The client name will be set to the type name of TClient.

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

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. O nome do cliente será definido como o nome do tipo de TClient.The client name will be set to the type name of TClient.

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

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. O nome do cliente será definido como o nome do tipo de TClient.The client name will be set to the type name of TClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection, String)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. O nome do cliente será definido como o nome do tipo de TClient.The client name will be set to the type name of TClient.

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

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.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>)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

AddHttpClient<TClient>(IServiceCollection)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. O nome do cliente será definido como o nome completo de TClient.The client name will be set to the full name of TClient.

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

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. O nome do cliente será definido como o nome do tipo de TClient.The client name will be set to the type name of TClient.

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

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. O nome do cliente será definido como o nome do tipo de TClient.The client name will be set to the type name of TClient.

AddHttpClient<TClient>(IServiceCollection, String)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.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>)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.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>)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient.

AddHttpClient(IServiceCollection)

Adiciona o IHttpClientFactory e os serviços relacionados à 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

Parâmetros

Retornos

AddHttpClient(IServiceCollection, String)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura um HttpClient nomeado.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

Parâmetros

name
String

O nome lógico do HttpClient a ser configurado.The logical name of the HttpClient to configure.

Retornos

Um IHttpClientBuilder que pode ser usado para configurar o cliente.An IHttpClientBuilder that can be used to configure the client.

Comentários

as instâncias HttpClient que aplicam a configuração fornecida podem ser recuperadas usando CreateClient(String) e fornecendo o nome correspondente. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

Use DefaultName como o nome para configurar o cliente padrão.Use DefaultName as the name to configure the default client.

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

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura um HttpClient nomeado.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

Parâmetros

name
String

O nome lógico do HttpClient a ser configurado.The logical name of the HttpClient to configure.

configureClient
Action<IServiceProvider,HttpClient>

Um delegado usado para configurar um HttpClient.A delegate that is used to configure an HttpClient.

Retornos

Um IHttpClientBuilder que pode ser usado para configurar o cliente.An IHttpClientBuilder that can be used to configure the client.

Comentários

as instâncias HttpClient que aplicam a configuração fornecida podem ser recuperadas usando CreateClient(String) e fornecendo o nome correspondente. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

Use DefaultName como o nome para configurar o cliente padrão.Use DefaultName as the name to configure the default client.

AddHttpClient(IServiceCollection, String, Action<HttpClient>)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura um HttpClient nomeado.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

Parâmetros

name
String

O nome lógico do HttpClient a ser configurado.The logical name of the HttpClient to configure.

configureClient
Action<HttpClient>

Um delegado usado para configurar um HttpClient.A delegate that is used to configure an HttpClient.

Retornos

Um IHttpClientBuilder que pode ser usado para configurar o cliente.An IHttpClientBuilder that can be used to configure the client.

Comentários

as instâncias HttpClient que aplicam a configuração fornecida podem ser recuperadas usando CreateClient(String) e fornecendo o nome correspondente. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

Use DefaultName como o nome para configurar o cliente padrão.Use DefaultName as the name to configure the default client.

AddHttpClient<TClient,TImplementation>(IServiceCollection)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. O nome do cliente será definido como o nome do tipo 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

Parâmetros de tipo

TClient

O tipo do cliente digitado.The type of the typed client. Os tipos especificados serão registrados na coleção de serviços como um serviço transitório.They type specified will be registered in the service collection as a transient service. Consulte ITypedHttpClientFactory<TClient> para obter mais detalhes sobre a criação de clientes digitados.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

O tipo de implementação do cliente digitado.The implementation type of the typed client. Os tipos especificados serão instanciados pelo ITypedHttpClientFactory<TClient>They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parâmetros

Retornos

Um IHttpClientBuilder que pode ser usado para configurar o cliente.An IHttpClientBuilder that can be used to configure the client.

Comentários

as instâncias HttpClient que aplicam a configuração fornecida podem ser recuperadas usando CreateClient(String) e fornecendo o nome correspondente. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

as instâncias TClient construídas com o HttpClient apropriado podem ser recuperadas de GetService(Type) (e métodos relacionados) fornecendo TClient como o tipo de serviço. 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>)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. O nome do cliente será definido como o nome do tipo 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

Parâmetros de tipo

TClient

O tipo do cliente digitado.The type of the typed client. Os tipos especificados serão registrados na coleção de serviços como um serviço transitório.They type specified will be registered in the service collection as a transient service. Consulte ITypedHttpClientFactory<TClient> para obter mais detalhes sobre a criação de clientes digitados.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

O tipo de implementação do cliente digitado.The implementation type of the typed client. Os tipos especificados serão instanciados pelo ITypedHttpClientFactory<TClient>They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parâmetros

configureClient
Action<IServiceProvider,HttpClient>

Um delegado usado para configurar um HttpClient.A delegate that is used to configure an HttpClient.

Retornos

Um IHttpClientBuilder que pode ser usado para configurar o cliente.An IHttpClientBuilder that can be used to configure the client.

Comentários

as instâncias HttpClient que aplicam a configuração fornecida podem ser recuperadas usando CreateClient(String) e fornecendo o nome correspondente. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

as instâncias TClient construídas com o HttpClient apropriado podem ser recuperadas de GetService(Type) (e métodos relacionados) fornecendo TClient como o tipo de serviço. 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>)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. O nome do cliente será definido como o nome do tipo 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

Parâmetros de tipo

TClient

O tipo do cliente digitado.The type of the typed client. Os tipos especificados serão registrados na coleção de serviços como um serviço transitório.They type specified will be registered in the service collection as a transient service. Consulte ITypedHttpClientFactory<TClient> para obter mais detalhes sobre a criação de clientes digitados.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

O tipo de implementação do cliente digitado.The implementation type of the typed client. Os tipos especificados serão instanciados pelo ITypedHttpClientFactory<TClient>They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parâmetros

configureClient
Action<HttpClient>

Um delegado usado para configurar um HttpClient.A delegate that is used to configure an HttpClient.

Retornos

Um IHttpClientBuilder que pode ser usado para configurar o cliente.An IHttpClientBuilder that can be used to configure the client.

Comentários

as instâncias HttpClient que aplicam a configuração fornecida podem ser recuperadas usando CreateClient(String) e fornecendo o nome correspondente. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

as instâncias TClient construídas com o HttpClient apropriado podem ser recuperadas de GetService(Type) (e métodos relacionados) fornecendo TClient como o tipo de serviço. 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)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. O nome do cliente será definido como o nome do tipo 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

Parâmetros de tipo

TClient

O tipo do cliente digitado.The type of the typed client. Os tipos especificados serão registrados na coleção de serviços como um serviço transitório.They type specified will be registered in the service collection as a transient service. Consulte ITypedHttpClientFactory<TClient> para obter mais detalhes sobre a criação de clientes digitados.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

O tipo de implementação do cliente digitado.The implementation type of the typed client. Os tipos especificados serão instanciados pelo ITypedHttpClientFactory<TClient>They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parâmetros

name
String

O nome lógico do HttpClient a ser configurado.The logical name of the HttpClient to configure.

Retornos

Um IHttpClientBuilder que pode ser usado para configurar o cliente.An IHttpClientBuilder that can be used to configure the client.

Comentários

as instâncias HttpClient que aplicam a configuração fornecida podem ser recuperadas usando CreateClient(String) e fornecendo o nome correspondente. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

as instâncias TClient construídas com o HttpClient apropriado podem ser recuperadas de GetService(Type) (e métodos relacionados) fornecendo TClient como o tipo de serviço. 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 como o nome para configurar o cliente padrão.Use DefaultName as the name to configure the default client.

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

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.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

Parâmetros de tipo

TClient

O tipo do cliente digitado.The type of the typed client. Os tipos especificados serão registrados na coleção de serviços como um serviço transitório.They type specified will be registered in the service collection as a transient service. Consulte ITypedHttpClientFactory<TClient> para obter mais detalhes sobre a criação de clientes digitados.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

O tipo de implementação do cliente digitado.The implementation type of the typed client. Os tipos especificados serão instanciados pelo ITypedHttpClientFactory<TClient>They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parâmetros

name
String

O nome lógico do HttpClient a ser configurado.The logical name of the HttpClient to configure.

configureClient
Action<IServiceProvider,HttpClient>

Um delegado usado para configurar um HttpClient.A delegate that is used to configure an HttpClient.

Retornos

Um IHttpClientBuilder que pode ser usado para configurar o cliente.An IHttpClientBuilder that can be used to configure the client.

Comentários

as instâncias HttpClient que aplicam a configuração fornecida podem ser recuperadas usando CreateClient(String) e fornecendo o nome correspondente. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

as instâncias TClient construídas com o HttpClient apropriado podem ser recuperadas de GetService(Type) (e métodos relacionados) fornecendo TClient como o tipo de serviço. 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 como o nome para configurar o cliente padrão.Use DefaultName as the name to configure the default client.

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

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.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

Parâmetros de tipo

TClient

O tipo do cliente digitado.The type of the typed client. Os tipos especificados serão registrados na coleção de serviços como um serviço transitório.They type specified will be registered in the service collection as a transient service. Consulte ITypedHttpClientFactory<TClient> para obter mais detalhes sobre a criação de clientes digitados.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

TImplementation

O tipo de implementação do cliente digitado.The implementation type of the typed client. Os tipos especificados serão instanciados pelo ITypedHttpClientFactory<TClient>They type specified will be instantiated by the ITypedHttpClientFactory<TClient>

Parâmetros

name
String

O nome lógico do HttpClient a ser configurado.The logical name of the HttpClient to configure.

configureClient
Action<HttpClient>

Um delegado usado para configurar um HttpClient.A delegate that is used to configure an HttpClient.

Retornos

Um IHttpClientBuilder que pode ser usado para configurar o cliente.An IHttpClientBuilder that can be used to configure the client.

Comentários

as instâncias HttpClient que aplicam a configuração fornecida podem ser recuperadas usando CreateClient(String) e fornecendo o nome correspondente. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

as instâncias TClient construídas com o HttpClient apropriado podem ser recuperadas de GetService(Type) (e métodos relacionados) fornecendo TClient como o tipo de serviço. 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 como o nome para configurar o cliente padrão.Use DefaultName as the name to configure the default client.

AddHttpClient<TClient>(IServiceCollection)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. O nome do cliente será definido como o nome completo 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

Parâmetros de tipo

TClient

O tipo do cliente digitado.The type of the typed client. Os tipos especificados serão registrados na coleção de serviços como um serviço transitório.They type specified will be registered in the service collection as a transient service. Consulte ITypedHttpClientFactory<TClient> para obter mais detalhes sobre a criação de clientes digitados.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Parâmetros

Retornos

Um IHttpClientBuilder que pode ser usado para configurar o cliente.An IHttpClientBuilder that can be used to configure the client.

Comentários

as instâncias HttpClient que aplicam a configuração fornecida podem ser recuperadas usando CreateClient(String) e fornecendo o nome correspondente. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

as instâncias TClient construídas com o HttpClient apropriado podem ser recuperadas de GetService(Type) (e métodos relacionados) fornecendo TClient como o tipo de serviço. 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>)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. O nome do cliente será definido como o nome do tipo 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

Parâmetros de tipo

TClient

O tipo do cliente digitado.The type of the typed client. Os tipos especificados serão registrados na coleção de serviços como um serviço transitório.They type specified will be registered in the service collection as a transient service. Consulte ITypedHttpClientFactory<TClient> para obter mais detalhes sobre a criação de clientes digitados.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Parâmetros

configureClient
Action<IServiceProvider,HttpClient>

Um delegado usado para configurar um HttpClient.A delegate that is used to configure an HttpClient.

Retornos

Um IHttpClientBuilder que pode ser usado para configurar o cliente.An IHttpClientBuilder that can be used to configure the client.

Comentários

as instâncias HttpClient que aplicam a configuração fornecida podem ser recuperadas usando CreateClient(String) e fornecendo o nome correspondente. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

as instâncias TClient construídas com o HttpClient apropriado podem ser recuperadas de GetService(Type) (e métodos relacionados) fornecendo TClient como o tipo de serviço. 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>)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.Adds the IHttpClientFactory and related services to the IServiceCollection and configures a binding between the TClient type and a named HttpClient. O nome do cliente será definido como o nome do tipo 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

Parâmetros de tipo

TClient

O tipo do cliente digitado.The type of the typed client. Os tipos especificados serão registrados na coleção de serviços como um serviço transitório.They type specified will be registered in the service collection as a transient service. Consulte ITypedHttpClientFactory<TClient> para obter mais detalhes sobre a criação de clientes digitados.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Parâmetros

configureClient
Action<HttpClient>

Um delegado usado para configurar um HttpClient.A delegate that is used to configure an HttpClient.

Retornos

Um IHttpClientBuilder que pode ser usado para configurar o cliente.An IHttpClientBuilder that can be used to configure the client.

Comentários

as instâncias HttpClient que aplicam a configuração fornecida podem ser recuperadas usando CreateClient(String) e fornecendo o nome correspondente. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

as instâncias TClient construídas com o HttpClient apropriado podem ser recuperadas de GetService(Type) (e métodos relacionados) fornecendo TClient como o tipo de serviço. 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)

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.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

Parâmetros de tipo

TClient

O tipo do cliente digitado.The type of the typed client. Os tipos especificados serão registrados na coleção de serviços como um serviço transitório.They type specified will be registered in the service collection as a transient service. Consulte ITypedHttpClientFactory<TClient> para obter mais detalhes sobre a criação de clientes digitados.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Parâmetros

name
String

O nome lógico do HttpClient a ser configurado.The logical name of the HttpClient to configure.

Retornos

Um IHttpClientBuilder que pode ser usado para configurar o cliente.An IHttpClientBuilder that can be used to configure the client.

Comentários

as instâncias HttpClient que aplicam a configuração fornecida podem ser recuperadas usando CreateClient(String) e fornecendo o nome correspondente. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

as instâncias TClient construídas com o HttpClient apropriado podem ser recuperadas de GetService(Type) (e métodos relacionados) fornecendo TClient como o tipo de serviço. 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 como o nome para configurar o cliente padrão.Use DefaultName as the name to configure the default client.

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

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.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

Parâmetros de tipo

TClient

O tipo do cliente digitado.The type of the typed client. Os tipos especificados serão registrados na coleção de serviços como um serviço transitório.They type specified will be registered in the service collection as a transient service. Consulte ITypedHttpClientFactory<TClient> para obter mais detalhes sobre a criação de clientes digitados.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Parâmetros

name
String

O nome lógico do HttpClient a ser configurado.The logical name of the HttpClient to configure.

configureClient
Action<IServiceProvider,HttpClient>

Um delegado usado para configurar um HttpClient.A delegate that is used to configure an HttpClient.

Retornos

Um IHttpClientBuilder que pode ser usado para configurar o cliente.An IHttpClientBuilder that can be used to configure the client.

Comentários

as instâncias HttpClient que aplicam a configuração fornecida podem ser recuperadas usando CreateClient(String) e fornecendo o nome correspondente. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

as instâncias TClient construídas com o HttpClient apropriado podem ser recuperadas de GetService(Type) (e métodos relacionados) fornecendo TClient como o tipo de serviço. 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 como o nome para configurar o cliente padrão.Use DefaultName as the name to configure the default client.

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

Adiciona o IHttpClientFactory e os serviços relacionados ao IServiceCollection e configura uma associação entre o tipo de TClient e um HttpClient nomeado.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

Parâmetros de tipo

TClient

O tipo do cliente digitado.The type of the typed client. Os tipos especificados serão registrados na coleção de serviços como um serviço transitório.They type specified will be registered in the service collection as a transient service. Consulte ITypedHttpClientFactory<TClient> para obter mais detalhes sobre a criação de clientes digitados.See ITypedHttpClientFactory<TClient> for more details about authoring typed clients.

Parâmetros

name
String

O nome lógico do HttpClient a ser configurado.The logical name of the HttpClient to configure.

configureClient
Action<HttpClient>

Um delegado usado para configurar um HttpClient.A delegate that is used to configure an HttpClient.

Retornos

Um IHttpClientBuilder que pode ser usado para configurar o cliente.An IHttpClientBuilder that can be used to configure the client.

Comentários

as instâncias HttpClient que aplicam a configuração fornecida podem ser recuperadas usando CreateClient(String) e fornecendo o nome correspondente. HttpClient instances that apply the provided configuration can be retrieved using CreateClient(String) and providing the matching name.

as instâncias TClient construídas com o HttpClient apropriado podem ser recuperadas de GetService(Type) (e métodos relacionados) fornecendo TClient como o tipo de serviço. 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 como o nome para configurar o cliente padrão.Use DefaultName as the name to configure the default client.

Aplica-se a