संपादित करें

इसके माध्यम से साझा किया गया


HttpMessageInvoker.Send(HttpRequestMessage, CancellationToken) Method

Definition

Sends an HTTP request with the specified request and cancellation token.

public:
 virtual System::Net::Http::HttpResponseMessage ^ Send(System::Net::Http::HttpRequestMessage ^ request, System::Threading::CancellationToken cancellationToken);
public virtual System.Net.Http.HttpResponseMessage Send (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken);
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public virtual System.Net.Http.HttpResponseMessage Send (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken);
abstract member Send : System.Net.Http.HttpRequestMessage * System.Threading.CancellationToken -> System.Net.Http.HttpResponseMessage
override this.Send : System.Net.Http.HttpRequestMessage * System.Threading.CancellationToken -> System.Net.Http.HttpResponseMessage
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
abstract member Send : System.Net.Http.HttpRequestMessage * System.Threading.CancellationToken -> System.Net.Http.HttpResponseMessage
override this.Send : System.Net.Http.HttpRequestMessage * System.Threading.CancellationToken -> System.Net.Http.HttpResponseMessage
Public Overridable Function Send (request As HttpRequestMessage, cancellationToken As CancellationToken) As HttpResponseMessage

Parameters

request
HttpRequestMessage

The HTTP request message to send.

cancellationToken
CancellationToken

The cancellation token to cancel operation.

Returns

The HTTP response message.

Attributes

Exceptions

The request was null.

For HTTP/2 and higher or when requesting version upgrade is enabled by RequestVersionOrHigher.

-or-

If using custom class derived from HttpContent not overriding SerializeToStream(Stream, TransportContext, CancellationToken) method.

-or-

If using custom HttpMessageHandler not overriding Send(HttpRequestMessage, CancellationToken) method.

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

Applies to