HttpClient.SendAsync Yöntem
Tanım
Bir HTTP isteğini zaman uyumsuz bir işlem olarak gönderin.Send an HTTP request as an asynchronous operation.
Aşırı Yüklemeler
| SendAsync(HttpRequestMessage, HttpCompletionOption, CancellationToken) |
Bir HTTP isteğini zaman uyumsuz bir işlem olarak gönderin.Send an HTTP request as an asynchronous operation. |
| SendAsync(HttpRequestMessage) |
Bir HTTP isteğini zaman uyumsuz bir işlem olarak gönderin.Send an HTTP request as an asynchronous operation. |
| SendAsync(HttpRequestMessage, HttpCompletionOption) |
Bir HTTP isteğini zaman uyumsuz bir işlem olarak gönderin.Send an HTTP request as an asynchronous operation. |
| SendAsync(HttpRequestMessage, CancellationToken) |
Bir HTTP isteğini zaman uyumsuz bir işlem olarak gönderin.Send an HTTP request as an asynchronous operation. |
Açıklamalar
Bu işlem engellenmeyecek.This operation will not block.
SendAsync(HttpRequestMessage, HttpCompletionOption, CancellationToken)
Bir HTTP isteğini zaman uyumsuz bir işlem olarak gönderin.Send an HTTP request as an asynchronous operation.
public:
System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ SendAsync(System::Net::Http::HttpRequestMessage ^ request, System::Net::Http::HttpCompletionOption completionOption, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> SendAsync (System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken);
override this.SendAsync : System.Net.Http.HttpRequestMessage * System.Net.Http.HttpCompletionOption * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
Public Function SendAsync (request As HttpRequestMessage, completionOption As HttpCompletionOption, cancellationToken As CancellationToken) As Task(Of HttpResponseMessage)
Parametreler
- request
- HttpRequestMessage
Göndermek için HTTP isteği iletisi.The HTTP request message to send.
- completionOption
- HttpCompletionOption
İşlem tamamlanmalı (bir yanıt varsa veya tüm yanıt içeriği okunduktan sonra).When the operation should complete (as soon as a response is available or after reading the whole response content).
- cancellationToken
- CancellationToken
İşlemi iptal etmek için iptal belirteci.The cancellation token to cancel operation.
Döndürülenler
Zaman uyumsuz işlemi temsil eden görev nesnesi.The task object representing the asynchronous operation.
Özel durumlar
request null .The request is null.
İstek iletisi, örnek tarafından zaten gönderildi HttpClient .The request message was already sent by the HttpClient instance.
Ağ bağlantısı, DNS hatası, sunucu sertifikası doğrulama veya zaman aşımı gibi temel bir sorun nedeniyle istek başarısız oldu.The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout.
Yalnızca .NET Core ve .NET 5,0 ve üzeri: istek zaman aşımı nedeniyle başarısız oldu..NET Core and .NET 5.0 and later only: The request failed due to timeout.
Açıklamalar
Bu işlem engellenmeyecek.This operation will not block. Parametrenin değerine bağlı olarak completionOption , döndürülen Task<TResult> nesne bir yanıt kullanılabilir duruma geldiğinde tamamlanır veya içerik da dahil olmak üzere tüm yanıt okunacaktır.Depending on the value of the completionOption parameter, the returned Task<TResult> object will complete as soon as a response is available or the entire response including content is read.
Not
Zaman aşımı durumunda farklı .NET uygulamalarında farklı özel durumlar oluşturulur.In case of timeout, different exceptions are thrown on different .NET implementations.
- HttpRequestException tüm uygulanabilir .NET Framework sürümlerinde oluşturulur.HttpRequestException is thrown on all applicable .NET Framework versions.
- TaskCanceledException herhangi bir iç özel durum olmadan, tüm geçerli .NET Core sürümlerinde oluşturulur.TaskCanceledException without any inner exception is thrown on all applicable .NET Core versions.
- TaskCanceledException Bu with TimeoutException , .NET 5,0 ve sonraki sürümlerde oluşturulur.TaskCanceledException that nests a TimeoutException is thrown on .NET 5.0 and later versions.
Şunlara uygulanır
SendAsync(HttpRequestMessage)
Bir HTTP isteğini zaman uyumsuz bir işlem olarak gönderin.Send an HTTP request as an asynchronous operation.
public:
System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ SendAsync(System::Net::Http::HttpRequestMessage ^ request);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> SendAsync (System.Net.Http.HttpRequestMessage request);
override this.SendAsync : System.Net.Http.HttpRequestMessage -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
Public Function SendAsync (request As HttpRequestMessage) As Task(Of HttpResponseMessage)
Parametreler
- request
- HttpRequestMessage
Göndermek için HTTP isteği iletisi.The HTTP request message to send.
Döndürülenler
Zaman uyumsuz işlemi temsil eden görev nesnesi.The task object representing the asynchronous operation.
Özel durumlar
request null .The request is null.
İstek iletisi, örnek tarafından zaten gönderildi HttpClient .The request message was already sent by the HttpClient instance.
Ağ bağlantısı, DNS hatası, sunucu sertifikası doğrulama veya zaman aşımı gibi temel bir sorun nedeniyle istek başarısız oldu.The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout.
Yalnızca .NET Core ve .NET 5,0 ve üzeri: istek zaman aşımı nedeniyle başarısız oldu..NET Core and .NET 5.0 and later only: The request failed due to timeout.
Açıklamalar
Bu işlem engellenmeyecek.This operation will not block. Döndürülen Task<TResult> nesne, içerik dahil tüm yanıt okunduktan sonra tamamlanır.The returned Task<TResult> object will complete once the entire response including content is read.
Not
Zaman aşımı durumunda farklı .NET uygulamalarında farklı özel durumlar oluşturulur.In case of timeout, different exceptions are thrown on different .NET implementations.
- HttpRequestException tüm uygulanabilir .NET Framework sürümlerinde oluşturulur.HttpRequestException is thrown on all applicable .NET Framework versions.
- TaskCanceledException herhangi bir iç özel durum olmadan, tüm geçerli .NET Core sürümlerinde oluşturulur.TaskCanceledException without any inner exception is thrown on all applicable .NET Core versions.
- TaskCanceledException Bu with TimeoutException , .NET 5,0 ve sonraki sürümlerde oluşturulur.TaskCanceledException that nests a TimeoutException is thrown on .NET 5.0 and later versions.
Şunlara uygulanır
SendAsync(HttpRequestMessage, HttpCompletionOption)
Bir HTTP isteğini zaman uyumsuz bir işlem olarak gönderin.Send an HTTP request as an asynchronous operation.
public:
System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ SendAsync(System::Net::Http::HttpRequestMessage ^ request, System::Net::Http::HttpCompletionOption completionOption);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> SendAsync (System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption);
override this.SendAsync : System.Net.Http.HttpRequestMessage * System.Net.Http.HttpCompletionOption -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
Public Function SendAsync (request As HttpRequestMessage, completionOption As HttpCompletionOption) As Task(Of HttpResponseMessage)
Parametreler
- request
- HttpRequestMessage
Göndermek için HTTP isteği iletisi.The HTTP request message to send.
- completionOption
- HttpCompletionOption
İşlem tamamlanmalı (bir yanıt varsa veya tüm yanıt içeriği okunduktan sonra).When the operation should complete (as soon as a response is available or after reading the whole response content).
Döndürülenler
Zaman uyumsuz işlemi temsil eden görev nesnesi.The task object representing the asynchronous operation.
Özel durumlar
request null .The request is null.
İstek iletisi, örnek tarafından zaten gönderildi HttpClient .The request message was already sent by the HttpClient instance.
Ağ bağlantısı, DNS hatası, sunucu sertifikası doğrulama veya zaman aşımı gibi temel bir sorun nedeniyle istek başarısız oldu.The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout.
Yalnızca .NET Core ve .NET 5,0 ve üzeri: istek zaman aşımı nedeniyle başarısız oldu..NET Core and .NET 5.0 and later only: The request failed due to timeout.
Açıklamalar
Bu işlem engellenmeyecek.This operation will not block. Parametrenin değerine bağlı olarak completionOption , döndürülen Task<TResult> nesne bir yanıt kullanılabilir duruma geldiğinde tamamlanır veya içerik da dahil olmak üzere tüm yanıt okunacaktır.Depending on the value of the completionOption parameter, the returned Task<TResult> object will complete as soon as a response is available or the entire response including content is read.
Not
Zaman aşımı durumunda farklı .NET uygulamalarında farklı özel durumlar oluşturulur.In case of timeout, different exceptions are thrown on different .NET implementations.
- HttpRequestException tüm uygulanabilir .NET Framework sürümlerinde oluşturulur.HttpRequestException is thrown on all applicable .NET Framework versions.
- TaskCanceledException herhangi bir iç özel durum olmadan, tüm geçerli .NET Core sürümlerinde oluşturulur.TaskCanceledException without any inner exception is thrown on all applicable .NET Core versions.
- TaskCanceledException Bu with TimeoutException , .NET 5,0 ve sonraki sürümlerde oluşturulur.TaskCanceledException that nests a TimeoutException is thrown on .NET 5.0 and later versions.
Şunlara uygulanır
SendAsync(HttpRequestMessage, CancellationToken)
Bir HTTP isteğini zaman uyumsuz bir işlem olarak gönderin.Send an HTTP request as an asynchronous operation.
public:
override System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ SendAsync(System::Net::Http::HttpRequestMessage ^ request, System::Threading::CancellationToken cancellationToken);
public 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>
Public Overrides Function SendAsync (request As HttpRequestMessage, cancellationToken As CancellationToken) As Task(Of HttpResponseMessage)
Parametreler
- request
- HttpRequestMessage
Göndermek için HTTP isteği iletisi.The HTTP request message to send.
- cancellationToken
- CancellationToken
İşlemi iptal etmek için iptal belirteci.The cancellation token to cancel operation.
Döndürülenler
Zaman uyumsuz işlemi temsil eden görev nesnesi.The task object representing the asynchronous operation.
Özel durumlar
request null .The request is null.
İstek iletisi, örnek tarafından zaten gönderildi HttpClient .The request message was already sent by the HttpClient instance.
Ağ bağlantısı, DNS hatası, sunucu sertifikası doğrulama veya zaman aşımı gibi temel bir sorun nedeniyle istek başarısız oldu.The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout.
Yalnızca .NET Core ve .NET 5,0 ve üzeri: istek zaman aşımı nedeniyle başarısız oldu..NET Core and .NET 5.0 and later only: The request failed due to timeout.
Açıklamalar
Bu işlem engellenmeyecek.This operation will not block. Döndürülen Task<TResult> nesne, içerik dahil tüm yanıt okunduktan sonra tamamlanır.The returned Task<TResult> object will complete once the entire response including content is read.
Not
Zaman aşımı durumunda farklı .NET uygulamalarında farklı özel durumlar oluşturulur.In case of timeout, different exceptions are thrown on different .NET implementations.
- HttpRequestException tüm uygulanabilir .NET Framework sürümlerinde oluşturulur.HttpRequestException is thrown on all applicable .NET Framework versions.
- TaskCanceledException herhangi bir iç özel durum olmadan, tüm geçerli .NET Core sürümlerinde oluşturulur.TaskCanceledException without any inner exception is thrown on all applicable .NET Core versions.
- TaskCanceledException Bu with TimeoutException , .NET 5,0 ve sonraki sürümlerde oluşturulur.TaskCanceledException that nests a TimeoutException is thrown on .NET 5.0 and later versions.