HttpClientFactoryServiceCollectionExtensions.AddHttpClient 方法

定义

重载

AddHttpClient(IServiceCollection)

IHttpClientFactory 和相关服务添加到 IServiceCollection

AddHttpClient(IServiceCollection, String)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置已命名的 HttpClient

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置已命名的 HttpClient

AddHttpClient(IServiceCollection, String, Action<HttpClient>)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置已命名的 HttpClient

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

AddHttpClient<TClient,TImplementation>(IServiceCollection, String)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 TClient 的类型名称。

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 TClient 的类型名称。

AddHttpClient<TClient,TImplementation>(IServiceCollection)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 TClient 的类型名称。

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 TClient 的类型名称。

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

AddHttpClient<TClient>(IServiceCollection, String)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 TClient 的类型名称。

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 TClient 的类型名称。

AddHttpClient<TClient>(IServiceCollection)

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 TClient 的全名。

AddHttpClient(IServiceCollection)

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

IHttpClientFactory 和相关服务添加到 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

参数

返回

IServiceCollection

适用于

AddHttpClient(IServiceCollection, String)

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置已命名的 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

参数

name
String

要配置的 HttpClient 的逻辑名称。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

使用 DefaultName 作为配置默认客户端的名称。

适用于

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

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置已命名的 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

参数

name
String

要配置的 HttpClient 的逻辑名称。

configureClient
Action<IServiceProvider,HttpClient>

用于配置 HttpClient 的委托。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

使用 DefaultName 作为配置默认客户端的名称。

适用于

AddHttpClient(IServiceCollection, String, Action<HttpClient>)

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置已命名的 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

参数

name
String

要配置的 HttpClient 的逻辑名称。

configureClient
Action<HttpClient>

用于配置 HttpClient 的委托。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

使用 DefaultName 作为配置默认客户端的名称。

适用于

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

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

TImplementation

类型化客户端的实现类型。

参数

name
String

要配置的 HttpClient 的逻辑名称。

factory
Func<HttpClient,IServiceProvider,TImplementation>

用于创建 TClient 的实例的委托。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

适用于

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

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

TImplementation

类型化客户端的实现类型。 指定的类型将由 实例化 ITypedHttpClientFactory<TClient>

参数

name
String

要配置的 HttpClient 的逻辑名称。

configureClient
Action<HttpClient>

用于配置 HttpClient 的委托。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

使用 DefaultName 作为配置默认客户端的名称。

适用于

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

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

TImplementation

类型化客户端的实现类型。 指定的类型将由 实例化 ITypedHttpClientFactory<TClient>

参数

name
String

要配置的 HttpClient 的逻辑名称。

configureClient
Action<IServiceProvider,HttpClient>

用于配置 HttpClient 的委托。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

使用 DefaultName 作为配置默认客户端的名称。

适用于

AddHttpClient<TClient,TImplementation>(IServiceCollection, String)

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

TImplementation

类型化客户端的实现类型。 指定的类型将由 实例化 ITypedHttpClientFactory<TClient>

参数

name
String

要配置的 HttpClient 的逻辑名称。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

使用 DefaultName 作为配置默认客户端的名称。

适用于

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

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

TImplementation

类型化客户端的实现类型。

参数

factory
Func<HttpClient,TImplementation>

用于创建 TClient 的实例的委托。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

适用于

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

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

TImplementation

类型化客户端的实现类型。

参数

factory
Func<HttpClient,IServiceProvider,TImplementation>

用于创建 TClient 的实例的委托。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

适用于

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

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

TImplementation

类型化客户端的实现类型。 指定的类型将由 实例化 ITypedHttpClientFactory<TClient>

参数

configureClient
Action<HttpClient>

用于配置 HttpClient 的委托。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

适用于

AddHttpClient<TClient,TImplementation>(IServiceCollection)

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

TImplementation

类型化客户端的实现类型。 指定的类型将由 实例化 ITypedHttpClientFactory<TClient>

参数

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

适用于

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

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

TImplementation

类型化客户端的实现类型。

参数

name
String

要配置的 HttpClient 的逻辑名称。

factory
Func<HttpClient,TImplementation>

用于创建 TClient 的实例的委托。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

适用于

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

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

TImplementation

类型化客户端的实现类型。 指定的类型将由 实例化 ITypedHttpClientFactory<TClient>

参数

configureClient
Action<IServiceProvider,HttpClient>

用于配置 HttpClient 的委托。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

适用于

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

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

参数

name
String

要配置的 HttpClient 的逻辑名称。

configureClient
Action<HttpClient>

用于配置 HttpClient 的委托。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

使用 DefaultName 作为配置默认客户端的名称。

适用于

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

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

参数

name
String

要配置的 HttpClient 的逻辑名称。

configureClient
Action<IServiceProvider,HttpClient>

用于配置 HttpClient 的委托。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

使用 DefaultName 作为配置默认客户端的名称。

适用于

AddHttpClient<TClient>(IServiceCollection, String)

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。

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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

参数

name
String

要配置的 HttpClient 的逻辑名称。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

使用 DefaultName 作为配置默认客户端的名称。

适用于

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

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

参数

configureClient
Action<HttpClient>

用于配置 HttpClient 的委托。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

适用于

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

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

参数

configureClient
Action<IServiceProvider,HttpClient>

用于配置 HttpClient 的委托。

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

适用于

AddHttpClient<TClient>(IServiceCollection)

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

IHttpClientFactory 和相关服务添加到 IServiceCollection,并配置 TClient 类型与已命名的 HttpClient 之间的绑定。 客户端名称将设置为 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

类型参数

TClient

类型化客户端的类型。 指定的类型将在服务集合中注册为暂时性服务。 有关创作类型化客户端的更多详细信息,请参阅 ITypedHttpClientFactory<TClient>

参数

返回

可用于配置客户端的 IHttpClientBuilder

注解

HttpClient可以使用检索应用提供的配置的实例 CreateClient(String) ,并提供匹配的名称。

TClient使用适当的构造的实例 HttpClient 可以 GetService(Type) 通过 TClient 作为服务类型提供,从(和相关方法)中进行检索。

适用于