HttpClientBuilderExtensions.ConfigureHttpClient 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
ConfigureHttpClient(IHttpClientBuilder, Action<HttpClient>) |
新增將用於設定具名 HttpClient 的委派。 |
ConfigureHttpClient(IHttpClientBuilder, Action<IServiceProvider,HttpClient>) |
新增將用於設定具名 HttpClient 的委派。 |
ConfigureHttpClient(IHttpClientBuilder, Action<HttpClient>)
新增將用於設定具名 HttpClient 的委派。
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ ConfigureHttpClient(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder, Action<System::Net::Http::HttpClient ^> ^ configureClient);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder ConfigureHttpClient (this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, Action<System.Net.Http.HttpClient> configureClient);
static member ConfigureHttpClient : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder * Action<System.Net.Http.HttpClient> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
<Extension()>
Public Function ConfigureHttpClient (builder As IHttpClientBuilder, configureClient As Action(Of HttpClient)) As IHttpClientBuilder
參數
- builder
- IHttpClientBuilder
- configureClient
- Action<HttpClient>
用於設定 HttpClient 的委派。
傳回
可以用於設定用戶端的 IHttpClientBuilder。
適用於
ConfigureHttpClient(IHttpClientBuilder, Action<IServiceProvider,HttpClient>)
新增將用於設定具名 HttpClient 的委派。
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ ConfigureHttpClient(Microsoft::Extensions::DependencyInjection::IHttpClientBuilder ^ builder, Action<IServiceProvider ^, System::Net::Http::HttpClient ^> ^ configureClient);
public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder ConfigureHttpClient (this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, Action<IServiceProvider,System.Net.Http.HttpClient> configureClient);
static member ConfigureHttpClient : Microsoft.Extensions.DependencyInjection.IHttpClientBuilder * Action<IServiceProvider, System.Net.Http.HttpClient> -> Microsoft.Extensions.DependencyInjection.IHttpClientBuilder
<Extension()>
Public Function ConfigureHttpClient (builder As IHttpClientBuilder, configureClient As Action(Of IServiceProvider, HttpClient)) As IHttpClientBuilder
參數
- builder
- IHttpClientBuilder
- configureClient
- Action<IServiceProvider,HttpClient>
用於設定 HttpClient 的委派。
傳回
可以用於設定用戶端的 IHttpClientBuilder。
備註
提供給 configureClient
的 IServiceProvider 會是相同應用程式的根服務提供者實例。