HttpClientFactoryServiceCollectionExtensions.AddHttpClient Metod

Definition

Överlagringar

Name Description
AddHttpClient(IServiceCollection)

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection.

AddHttpClient(IServiceCollection, String)

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en med namnet HttpClient.

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

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en med namnet HttpClient.

AddHttpClient(IServiceCollection, String, Action<HttpClient>)

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en med namnet HttpClient.

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

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

AddHttpClient<TClient,TImplementation>(IServiceCollection, String)

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient . Klientnamnet anges till typnamnet TClientför .

AddHttpClient<TClient,TImplementation>(IServiceCollection)

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient . Klientnamnet anges till typnamnet TClientför .

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

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient . Klientnamnet anges till typnamnet TClientför .

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

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

AddHttpClient<TClient>(IServiceCollection, String)

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient . Klientnamnet anges till typnamnet TClientför .

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

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient . Klientnamnet anges till typnamnet TClientför .

AddHttpClient<TClient>(IServiceCollection)

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient . Klientnamnet anges till typnamnet TClientför .

AddHttpClient(IServiceCollection)

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till 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

Parametrar

Returer

IServiceCollection.

Gäller för

AddHttpClient(IServiceCollection, String)

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en med namnet 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

Parametrar

name
String

Det logiska namnet på den som ska konfigureras HttpClient .

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

Använd DefaultName som namn för att konfigurera standardklienten.

Gäller för

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

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en med namnet 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

Parametrar

name
String

Det logiska namnet på den som ska konfigureras HttpClient .

configureClient
Action<IServiceProvider,HttpClient>

Ett ombud som används för att konfigurera en HttpClient.

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

Använd DefaultName som namn för att konfigurera standardklienten.

Gäller för

AddHttpClient(IServiceCollection, String, Action<HttpClient>)

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en med namnet 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

Parametrar

name
String

Det logiska namnet på den som ska konfigureras HttpClient .

configureClient
Action<HttpClient>

Ett ombud som används för att konfigurera en HttpClient.

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

Använd DefaultName som namn för att konfigurera standardklienten.

Gäller för

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

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

TImplementation

Implementeringstypen för den typerade klienten.

Parametrar

name
String

Det logiska namnet på den som ska konfigureras HttpClient .

factory
Func<HttpClient,IServiceProvider,TImplementation>

Ett ombud som används för att skapa en instans av TClient.

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

Gäller för

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

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

TImplementation

Implementeringstypen för den typerade klienten. Den angivna typen instansieras av ITypedHttpClientFactory<TClient>.

Parametrar

name
String

Det logiska namnet på den som ska konfigureras HttpClient .

configureClient
Action<HttpClient>

Ett ombud som används för att konfigurera en HttpClient.

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

Använd DefaultName som namn för att konfigurera standardklienten.

Gäller för

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

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

TImplementation

Implementeringstypen för den typerade klienten. Den angivna typen instansieras av ITypedHttpClientFactory<TClient>.

Parametrar

name
String

Det logiska namnet på den som ska konfigureras HttpClient .

configureClient
Action<IServiceProvider,HttpClient>

Ett ombud som används för att konfigurera en HttpClient.

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

Använd DefaultName som namn för att konfigurera standardklienten.

Gäller för

AddHttpClient<TClient,TImplementation>(IServiceCollection, String)

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

TImplementation

Implementeringstypen för den typerade klienten. Den angivna typen instansieras av ITypedHttpClientFactory<TClient>.

Parametrar

name
String

Det logiska namnet på den som ska konfigureras HttpClient .

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

Använd DefaultName som namn för att konfigurera standardklienten.

Gäller för

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

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

TImplementation

Implementeringstypen för den typerade klienten.

Parametrar

factory
Func<HttpClient,TImplementation>

Ett ombud som används för att skapa en instans av TClient.

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

Gäller för

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

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

TImplementation

Implementeringstypen för den typerade klienten.

Parametrar

factory
Func<HttpClient,IServiceProvider,TImplementation>

Ett ombud som används för att skapa en instans av TClient.

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

Gäller för

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

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient . Klientnamnet anges till typnamnet TClientför .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

TImplementation

Implementeringstypen för den typerade klienten. Den angivna typen instansieras av ITypedHttpClientFactory<TClient>.

Parametrar

configureClient
Action<HttpClient>

Ett ombud som används för att konfigurera en HttpClient.

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

Gäller för

AddHttpClient<TClient,TImplementation>(IServiceCollection)

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient . Klientnamnet anges till typnamnet TClientför .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

TImplementation

Implementeringstypen för den typerade klienten. Den angivna typen instansieras av ITypedHttpClientFactory<TClient>.

Parametrar

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

Gäller för

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

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

TImplementation

Implementeringstypen för den typerade klienten.

Parametrar

name
String

Det logiska namnet på den som ska konfigureras HttpClient .

factory
Func<HttpClient,TImplementation>

Ett ombud som används för att skapa en instans av TClient.

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

TImplementation

Gäller för

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

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient . Klientnamnet anges till typnamnet TClientför .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

TImplementation

Implementeringstypen för den typerade klienten. Den angivna typen instansieras av ITypedHttpClientFactory<TClient>.

Parametrar

configureClient
Action<IServiceProvider,HttpClient>

Ett ombud som används för att konfigurera en HttpClient.

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

Gäller för

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

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

Parametrar

name
String

Det logiska namnet på den som ska konfigureras HttpClient .

configureClient
Action<HttpClient>

Ett ombud som används för att konfigurera en HttpClient.

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

Använd DefaultName som namn för att konfigurera standardklienten.

Gäller för

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

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

Parametrar

name
String

Det logiska namnet på den som ska konfigureras HttpClient .

configureClient
Action<IServiceProvider,HttpClient>

Ett ombud som används för att konfigurera en HttpClient.

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

Använd DefaultName som namn för att konfigurera standardklienten.

Gäller för

AddHttpClient<TClient>(IServiceCollection, String)

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

Parametrar

name
String

Det logiska namnet på den som ska konfigureras HttpClient .

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

Använd DefaultName som namn för att konfigurera standardklienten.

Gäller för

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

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient . Klientnamnet anges till typnamnet TClientför .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

Parametrar

configureClient
Action<HttpClient>

Ett ombud som används för att konfigurera en HttpClient.

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

Gäller för

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

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient . Klientnamnet anges till typnamnet TClientför .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

Parametrar

configureClient
Action<IServiceProvider,HttpClient>

Ett ombud som används för att konfigurera en HttpClient.

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

Gäller för

AddHttpClient<TClient>(IServiceCollection)

Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs
Källa:
HttpClientFactoryServiceCollectionExtensions.cs

Lägger till och IHttpClientFactory relaterade tjänster till IServiceCollection och konfigurerar en bindning mellan typen och en namngiven HttpClientTClient . Klientnamnet anges till typnamnet TClientför .

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

Typparametrar

TClient

Typ av typ av klient. Den angivna typen registreras i tjänstsamlingen som en tillfällig tjänst. Mer ITypedHttpClientFactory<TClient> information om hur du redigerar inskrivna klienter finns i.

Parametrar

Returer

En IHttpClientBuilder som kan användas för att konfigurera klienten.

Kommentarer

HttpClient instanser som tillämpar den angivna konfigurationen kan hämtas med hjälp av CreateClient(String) och tillhandahålla matchande namn.

TClient instanser som skapats med lämpliga HttpClient kan hämtas från GetService(Type) (och relaterade metoder) genom att tillhandahålla TClient som tjänsttyp.

Gäller för