Επεξεργασία

Κοινή χρήση μέσω


HttpClientHandler.SendAsync(HttpRequestMessage, CancellationToken) Method

Definition

Creates an instance of HttpResponseMessage based on the information provided in the HttpRequestMessage as an operation that will not block.

protected public:
 override System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ SendAsync(System::Net::Http::HttpRequestMessage ^ request, System::Threading::CancellationToken cancellationToken);
protected internal override System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken);
override this.SendAsync : System.Net.Http.HttpRequestMessage * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
Protected Friend Overrides Function SendAsync (request As HttpRequestMessage, cancellationToken As CancellationToken) As Task(Of HttpResponseMessage)

Parameters

request
HttpRequestMessage

The HTTP request message.

cancellationToken
CancellationToken

A cancellation token to cancel the operation.

Returns

The task object representing the asynchronous operation.

Exceptions

The request was null.

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

This operation is does not block. It returns an instance of Task<TResult> to represent the asynchronous operation. When the operation completes, Result contains the response message.

Applies to