HttpClientFactoryServiceCollectionExtensions.AddHttpClient Método

Definición

Sobrecargas

AddHttpClient(IServiceCollection)

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection.

AddHttpClient(IServiceCollection, String)

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un objeto HttpClient con nombre.

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un objeto HttpClient con nombre.

AddHttpClient(IServiceCollection, String, Action<HttpClient>)

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un objeto HttpClient con nombre.

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

AddHttpClient<TClient,TImplementation>(IServiceCollection, String)

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre. El nombre de cliente se establecerá en el nombre de tipo de TClient.

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre. El nombre de cliente se establecerá en el nombre de tipo de TClient.

AddHttpClient<TClient,TImplementation>(IServiceCollection)

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre. El nombre de cliente se establecerá en el nombre de tipo de TClient.

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre. El nombre de cliente se establecerá en el nombre de tipo de TClient.

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

AddHttpClient<TClient>(IServiceCollection, String)

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre. El nombre de cliente se establecerá en el nombre de tipo de TClient.

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre. El nombre de cliente se establecerá en el nombre de tipo de TClient.

AddHttpClient<TClient>(IServiceCollection)

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre. El nombre de cliente se establecerá en el nombre completo de TClient.

AddHttpClient(IServiceCollection)

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

Agrega IHttpClientFactory y los servicios relacionados a 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

Devoluciones

IServiceCollection.

Se aplica a

AddHttpClient(IServiceCollection, String)

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un objeto HttpClient con nombre.

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

El nombre lógico del objeto HttpClient que se va a configurar.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

Use DefaultName como nombre para configurar el cliente predeterminado.

Se aplica a

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

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un objeto HttpClient con nombre.

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

El nombre lógico del objeto HttpClient que se va a configurar.

configureClient
Action<IServiceProvider,HttpClient>

Un delegado que se usa para configurar un objeto HttpClient.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

Use DefaultName como nombre para configurar el cliente predeterminado.

Se aplica a

AddHttpClient(IServiceCollection, String, Action<HttpClient>)

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un objeto HttpClient con nombre.

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

El nombre lógico del objeto HttpClient que se va a configurar.

configureClient
Action<HttpClient>

Un delegado que se usa para configurar un objeto HttpClient.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

Use DefaultName como nombre para configurar el cliente predeterminado.

Se aplica a

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

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Parámetros de tipo

TClient

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

TImplementation

Tipo de implementación del cliente con tipo.

Parámetros

name
String

El nombre lógico del objeto HttpClient que se va a configurar.

factory
Func<HttpClient,IServiceProvider,TImplementation>

Delegado que se usa para crear una instancia de TClient.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Se aplica a

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

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

TImplementation

Tipo de implementación del cliente con tipo. El tipo especificado se creará mediante la instancia de ITypedHttpClientFactory<TClient>.

Parámetros

name
String

El nombre lógico del objeto HttpClient que se va a configurar.

configureClient
Action<HttpClient>

Un delegado que se usa para configurar un objeto HttpClient.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Use DefaultName como nombre para configurar el cliente predeterminado.

Se aplica a

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

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

TImplementation

Tipo de implementación del cliente con tipo. El tipo especificado se creará mediante la instancia de ITypedHttpClientFactory<TClient>.

Parámetros

name
String

El nombre lógico del objeto HttpClient que se va a configurar.

configureClient
Action<IServiceProvider,HttpClient>

Un delegado que se usa para configurar un objeto HttpClient.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Use DefaultName como nombre para configurar el cliente predeterminado.

Se aplica a

AddHttpClient<TClient,TImplementation>(IServiceCollection, String)

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre. El nombre de cliente se establecerá en el nombre de tipo de 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

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

TImplementation

Tipo de implementación del cliente con tipo. El tipo especificado se creará mediante la instancia de ITypedHttpClientFactory<TClient>.

Parámetros

name
String

El nombre lógico del objeto HttpClient que se va a configurar.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Use DefaultName como nombre para configurar el cliente predeterminado.

Se aplica a

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

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Parámetros de tipo

TClient

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

TImplementation

Tipo de implementación del cliente con tipo.

Parámetros

factory
Func<HttpClient,TImplementation>

Delegado que se usa para crear una instancia de TClient.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Se aplica a

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

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Parámetros de tipo

TClient

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

TImplementation

Tipo de implementación del cliente con tipo.

Parámetros

factory
Func<HttpClient,IServiceProvider,TImplementation>

Delegado que se usa para crear una instancia de TClient.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Se aplica a

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

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre. El nombre de cliente se establecerá en el nombre de tipo de 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

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

TImplementation

Tipo de implementación del cliente con tipo. El tipo especificado se creará mediante la instancia de ITypedHttpClientFactory<TClient>.

Parámetros

configureClient
Action<HttpClient>

Un delegado que se usa para configurar un objeto HttpClient.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Se aplica a

AddHttpClient<TClient,TImplementation>(IServiceCollection)

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre. El nombre de cliente se establecerá en el nombre de tipo de 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

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

TImplementation

Tipo de implementación del cliente con tipo. El tipo especificado se creará mediante la instancia de ITypedHttpClientFactory<TClient>.

Parámetros

services
IServiceCollection

El parámetro de cadena de consulta IServiceCollection.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Se aplica a

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

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Parámetros de tipo

TClient

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

TImplementation

Tipo de implementación del cliente con tipo.

Parámetros

name
String

El nombre lógico del objeto HttpClient que se va a configurar.

factory
Func<HttpClient,TImplementation>

Delegado que se usa para crear una instancia de TClient.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Se aplica a

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

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre. El nombre de cliente se establecerá en el nombre de tipo de 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

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

TImplementation

Tipo de implementación del cliente con tipo. El tipo especificado se creará mediante la instancia de ITypedHttpClientFactory<TClient>.

Parámetros

configureClient
Action<IServiceProvider,HttpClient>

Un delegado que se usa para configurar un objeto HttpClient.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Se aplica a

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

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

Parámetros

name
String

El nombre lógico del objeto HttpClient que se va a configurar.

configureClient
Action<HttpClient>

Un delegado que se usa para configurar un objeto HttpClient.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Use DefaultName como nombre para configurar el cliente predeterminado.

Se aplica a

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

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

Parámetros

name
String

El nombre lógico del objeto HttpClient que se va a configurar.

configureClient
Action<IServiceProvider,HttpClient>

Un delegado que se usa para configurar un objeto HttpClient.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Use DefaultName como nombre para configurar el cliente predeterminado.

Se aplica a

AddHttpClient<TClient>(IServiceCollection, String)

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre.

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

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

Parámetros

name
String

El nombre lógico del objeto HttpClient que se va a configurar.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Use DefaultName como nombre para configurar el cliente predeterminado.

Se aplica a

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

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre. El nombre de cliente se establecerá en el nombre de tipo de 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

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

Parámetros

configureClient
Action<HttpClient>

Un delegado que se usa para configurar un objeto HttpClient.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Se aplica a

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

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre. El nombre de cliente se establecerá en el nombre de tipo de 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

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

Parámetros

configureClient
Action<IServiceProvider,HttpClient>

Un delegado que se usa para configurar un objeto HttpClient.

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Se aplica a

AddHttpClient<TClient>(IServiceCollection)

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

Agrega IHttpClientFactory y los servicios relacionados a IServiceCollection y configura un enlace entre el tipo TClient y un objeto HttpClient con nombre. El nombre de cliente se establecerá en el nombre completo de 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

Tipo del cliente con tipo. El tipo especificado se registrará en la colección de servicios como un servicio transitorio. Consulte ITypedHttpClientFactory<TClient> para obtener más detalles sobre la creación de clientes con tipo.

Parámetros

Devoluciones

Un objeto IHttpClientBuilder que se puede usar para configurar el cliente.

Comentarios

HttpClientlas instancias que aplican la configuración proporcionada se pueden recuperar mediante CreateClient(String) y proporcionando el nombre coincidente.

TClientlas instancias construidas con el adecuado HttpClient se pueden recuperar de GetService(Type) (y métodos relacionados) proporcionando TClient como tipo de servicio.

Se aplica a