WebApplicationFactory<TEntryPoint>.CreateDefaultClient 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
CreateDefaultClient(DelegatingHandler[]) |
建立可用來傳送 HttpRequestMessage 至伺服器的新實例 HttpClient 。 實例的 HttpClient 基底位址將會設定為 |
CreateDefaultClient(Uri, DelegatingHandler[]) |
建立可用來傳送 HttpRequestMessage 至伺服器的新實例 HttpClient 。 |
CreateDefaultClient(DelegatingHandler[])
建立可用來傳送 HttpRequestMessage 至伺服器的新實例 HttpClient 。 實例的 HttpClient 基底位址將會設定為 http://localhost
。
public:
System::Net::Http::HttpClient ^ CreateDefaultClient(... cli::array <System::Net::Http::DelegatingHandler ^> ^ handlers);
public System.Net.Http.HttpClient CreateDefaultClient (params System.Net.Http.DelegatingHandler[] handlers);
member this.CreateDefaultClient : System.Net.Http.DelegatingHandler[] -> System.Net.Http.HttpClient
Public Function CreateDefaultClient (ParamArray handlers As DelegatingHandler()) As HttpClient
參數
- handlers
- DelegatingHandler[]
要設定在 HttpClient 上的實例清單 DelegatingHandler 。
傳回
適用於
CreateDefaultClient(Uri, DelegatingHandler[])
建立可用來傳送 HttpRequestMessage 至伺服器的新實例 HttpClient 。
public:
System::Net::Http::HttpClient ^ CreateDefaultClient(Uri ^ baseAddress, ... cli::array <System::Net::Http::DelegatingHandler ^> ^ handlers);
public System.Net.Http.HttpClient CreateDefaultClient (Uri baseAddress, params System.Net.Http.DelegatingHandler[] handlers);
member this.CreateDefaultClient : Uri * System.Net.Http.DelegatingHandler[] -> System.Net.Http.HttpClient
Public Function CreateDefaultClient (baseAddress As Uri, ParamArray handlers As DelegatingHandler()) As HttpClient
參數
- baseAddress
- Uri
實例的 HttpClient 基底位址。
- handlers
- DelegatingHandler[]
要設定在 HttpClient 上的實例清單 DelegatingHandler 。