HttpClient Sınıf

Tanım

HTTP istekleri göndermek ve URI tarafından tanımlanan bir kaynaktan HTTP yanıtlarını almak için bir sınıf sağlar.Provides a class for sending HTTP requests and receiving HTTP responses from a resource identified by a URI.

public ref class HttpClient : System::Net::Http::HttpMessageInvoker
public class HttpClient : System.Net.Http.HttpMessageInvoker
type HttpClient = class
    inherit HttpMessageInvoker
Public Class HttpClient
Inherits HttpMessageInvoker
Devralma

Örnekler

// HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
static readonly HttpClient client = new HttpClient();

static async Task Main()
{
  // Call asynchronous network methods in a try/catch block to handle exceptions.
  try	
  {
     HttpResponseMessage response = await client.GetAsync("http://www.contoso.com/");
     response.EnsureSuccessStatusCode();
     string responseBody = await response.Content.ReadAsStringAsync();
     // Above three lines can be replaced with new helper method below
     // string responseBody = await client.GetStringAsync(uri);

     Console.WriteLine(responseBody);
  }
  catch(HttpRequestException e)
  {
     Console.WriteLine("\nException Caught!");	
     Console.WriteLine("Message :{0} ",e.Message);
  }
}
' HttpClient is intended to be instantiated once per application, rather than per-use. See Remarks.
Shared ReadOnly client As HttpClient = New HttpClient()

Private Shared Async Function Main() As Task
    ' Call asynchronous network methods in a try/catch block to handle exceptions.
    Try
        Dim response As HttpResponseMessage = Await client.GetAsync("http://www.contoso.com/")
        response.EnsureSuccessStatusCode()
        Dim responseBody As String = Await response.Content.ReadAsStringAsync()
        ' Above three lines can be replaced with new helper method below
        ' Dim responseBody As String = Await client.GetStringAsync(uri)

        Console.WriteLine(responseBody)
    Catch e As HttpRequestException
        Console.WriteLine(Environment.NewLine & "Exception Caught!")
        Console.WriteLine("Message :{0} ", e.Message)
    End Try
End Function

Yukarıdaki kod örneği bir async Task Main() giriş noktası kullanır.The preceding code example uses an async Task Main() entry point. Bu özellik C# 7,1 veya üstünü gerektirir.That feature requires C# 7.1 or later.

Açıklamalar

HttpClientSınıf örneği, http istekleri göndermek için bir oturum görevi görür.The HttpClient class instance acts as a session to send HTTP requests. HttpClientÖrnek, bu örnek tarafından yürütülen tüm isteklere uygulanan ayarların koleksiyonudur.An HttpClient instance is a collection of settings applied to all requests executed by that instance. Bunlara ek olarak, her HttpClient örnek kendi bağlantı havuzunu kullanır ve bu, isteklerini diğer örnekler tarafından yürütülen isteklerden yalılarsa HttpClient .In addition, every HttpClient instance uses its own connection pool, isolating its requests from requests executed by other HttpClient instances.

Türetilmiş sınıflar sınıftaki sanal yöntemleri geçersiz kılmamalıdır.Derived classes should not override the virtual methods on the class. Bunun yerine, HttpMessageHandler herhangi bir ön veya istek sonrası işlemi yapılandırmak için kabul eden bir Oluşturucu aşırı yüklemesi kullanın.Instead, use a constructor overload that accepts HttpMessageHandler to configure any pre- or post-request processing.

.NET Framework ve mono üzerinde varsayılan olarak, HttpWebRequest sunucuya istek göndermek için kullanılır.By default on .NET Framework and Mono, HttpWebRequest is used to send requests to the server. Bu davranış, bir örneği parametre olarak alan Oluşturucu aşırı yüklemelerinin birinde farklı bir kanal belirtilerek değiştirilebilir HttpMessageHandler .This behavior can be modified by specifying a different channel in one of the constructor overloads taking a HttpMessageHandler instance as parameter. Kimlik doğrulama veya önbelleğe alma gibi özellikler gerekliyse, WebRequestHandler ayarları yapılandırmak için kullanılabilir ve örnek oluşturucuya geçirilebilir.If features like authentication or caching are required, WebRequestHandler can be used to configure settings and the instance can be passed to the constructor. Döndürülen işleyici bir parametre alan Oluşturucu aşırı yüklemelerinin birine geçirilebilir HttpMessageHandler .The returned handler can be passed to one of the constructor overloads taking a HttpMessageHandler parameter.

Kullanan bir uygulama HttpClient ve System.Net.Http ad alanındaki ilgili sınıflar büyük miktarlarda veri indirmeyi (50 megabayt veya daha fazla) kullanıyorsa, uygulamanın bu indirmeleri akışı gerekir ve Varsayılan arabelleğe almayı kullanmaz.If an app using HttpClient and related classes in the System.Net.Http namespace intends to download large amounts of data (50 megabytes or more), then the app should stream those downloads and not use the default buffering. Varsayılan arabelleğe alma kullanılırsa, istemci belleği kullanımı çok büyük olur ve büyük olasılıkla performansı önemli ölçüde düşürür.If the default buffering is used the client memory usage will get very large, potentially resulting in substantially reduced performance.

Özellikleri, HttpClient iş parçacığı açısından güvenli olmadığından, bekleyen istekler varken değiştirilmemelidir.Properties of HttpClient should not be modified while there are outstanding requests, because it is not thread-safe.

Aşağıdaki yöntemler iş parçacığı güvenlidir:The following methods are thread safe:

  1. CancelPendingRequests

  2. DeleteAsync

  3. GetAsync

  4. GetByteArrayAsync

  5. GetStreamAsync

  6. GetStringAsync

  7. PostAsync

  8. PutAsync

  9. SendAsync

  10. PatchAsync

HttpClient uygulamasının bir kez oluşturulması ve bir uygulamanın ömrü boyunca yeniden kullanılması amaçlanmıştır.HttpClient is intended to be instantiated once and re-used throughout the life of an application. Her istek için bir HttpClient sınıfının örneği, ağır yüklerin altında bulunan yuva sayısını tükeder.Instantiating an HttpClient class for every request will exhaust the number of sockets available under heavy loads. Bu, SocketException hatalarına neden olur.This will result in SocketException errors. Aşağıda, HttpClient 'ı doğru kullanan bir örnek verilmiştir.Below is an example using HttpClient correctly.

public class GoodController : ApiController
{
    private static readonly HttpClient HttpClient;

    static GoodController()
    {
        HttpClient = new HttpClient();
    }
}
  Public Class GoodController
    Inherits ApiController  

    Private Shared ReadOnly HttpClient As HttpClient  

    Shared Sub New()  
        HttpClient = New HttpClient()
    End Sub
End Class

, HttpClient Çalıştığı her platformda kullanılabilen alt düzey işlevselliği sarmalayan üst düzey BIR API 'dir.The HttpClient is a high-level API that wraps the lower-level functionality available on each platform where it runs.

Her platformda, HttpClient kullanılabilir en iyi aktarımı kullanmaya çalışır:On each platform, HttpClient tries to use the best available transport:

Konak/çalışma zamanıHost/Runtime SunucusundanBackend
Windows/. NET FrameworkWindows/.NET Framework HttpWebRequest
Windows/monoWindows/Mono HttpWebRequest
Windows/UWPWindows/UWP Windows Native WinHttpHandler (HTTP 2,0 uyumlu)Windows native WinHttpHandler (HTTP 2.0 capable)
Windows/. NET Core 1.0-2.0Windows/.NET Core 1.0-2.0 Windows Native WinHttpHandler (HTTP 2,0 uyumlu)Windows native WinHttpHandler (HTTP 2.0 capable)
Android/XamarinAndroid/Xamarin Oluşturma zamanında seçildi.Selected at build-time. , HttpWebRequest Android 'in yerel kullanacak şekilde kullanabilir veya yapılandırılabilir HttpURLConnectionCan either use HttpWebRequest or be configured to use Android's native HttpURLConnection
iOS, tvOS, watchOS/XamariniOS, tvOS, watchOS/Xamarin Oluşturma zamanında seçildi.Selected at build-time. , HttpWebRequest Apple 'ın NSUrlSession (http 2,0 özellikli) kullanılması için kullanabilir ya da yapılandırılabilirCan either use HttpWebRequest or be configured to use Apple's NSUrlSession (HTTP 2.0 capable)
macOS/XamarinmacOS/Xamarin Oluşturma zamanında seçildi.Selected at build-time. , HttpWebRequest Apple 'ın NSUrlSession (http 2,0 özellikli) kullanılması için kullanabilir ya da yapılandırılabilirCan either use HttpWebRequest or be configured to use Apple's NSUrlSession (HTTP 2.0 capable)
macOS/monomacOS/Mono HttpWebRequest
macOS/. NET Core 1.0-2.0macOS/.NET Core 1.0-2.0 libcurltabanlı HTTP taşıması (HTTP 2,0 uyumlu)libcurl-based HTTP transport (HTTP 2.0 capable)
Linux/monoLinux/Mono HttpWebRequest
Linux/. NET Core 1.0-2.0Linux/.NET Core 1.0-2.0 libcurltabanlı HTTP taşıması (HTTP 2,0 uyumlu)libcurl-based HTTP transport (HTTP 2.0 capable)
.NET Core 2,1 ve üzeri.NET Core 2.1 and later System.Net.Http.SocketsHttpHandler

Kullanıcılar HttpClient , bir öğesini alan oluşturucuyu çağırarak, için belirli bir aktarımı da yapılandırabilir HttpClient HttpMessageHandler .Users can also configure a specific transport for HttpClient by invoking the HttpClient constructor that takes an HttpMessageHandler.

HttpClient ve .NET CoreHttpClient and .NET Core

.NET Core 2,1 ile başlayarak, System.Net.Http.SocketsHttpHandler yerine sınıfı, HttpClientHandler daha üst düzey http ağ sınıfları tarafından kullanılan uygulamayı sağlar HttpClient .Starting with .NET Core 2.1, the System.Net.Http.SocketsHttpHandler class instead of HttpClientHandler provides the implementation used by higher-level HTTP networking classes such as HttpClient. Kullanımı çok SocketsHttpHandler sayıda avantaj sunar:The use of SocketsHttpHandler offers a number of advantages:

  • Önceki uygulamayla karşılaştırıldığında önemli bir performans geliştirmesi.A significant performance improvement when compared with the previous implementation.
  • Dağıtım ve hizmeti kolaylaştıran platform bağımlılıklarının yok etme.The elimination of platform dependencies, which simplifies deployment and servicing. Örneğin, libcurl artık macOS ve Linux için .NET Core 'a yönelik .NET Core bağımlılığı yoktur.For example, libcurl is no longer a dependency on .NET Core for macOS and .NET Core for Linux.
  • Tüm .NET platformları genelinde tutarlı davranış.Consistent behavior across all .NET platforms.

Bu değişiklik istenmeye devam ediyorsa, Windows üzerinde hala bu WinHttpHandler dosyanın NuGet paketine başvurarak ve HttpClient oluşturucuyu el ile geçirerek kullanmaya devam edebilirsiniz.If this change is undesirable, on Windows you can still use WinHttpHandler by referencing it's NuGet package and passing it to HttpClient's constructor manually.

Çalışma zamanı yapılandırma seçeneklerini kullanarak davranışı yapılandırmaConfigure behavior using run-time configuration options

Davranışının belirli yönleri HttpClient , çalışma zamanı yapılandırma seçenekleriaracılığıyla özelleştirilebilir.Certain aspects of HttpClient's behavior are customizable through Run-time configuration options. Ancak, bu anahtarların davranışı .NET sürümlerindekilerle farklılık gösterir.However, the behavior of these switches differs through .NET versions. Örneğin, .NET Core 2,1-3,1 ' de, varsayılan olarak kullanılıp kullanılmayacağını yapılandırabilir SocketsHttpHandler , ancak bu seçenek .net 5,0 ' den itibaren artık kullanılamaz.For example, in .NET Core 2.1 - 3.1, you can configure whether SocketsHttpHandler is used by default, but that option is no longer available starting in .NET 5.0.

Oluşturucular

HttpClient()

HttpClient HttpClientHandler Bu örnek atıldıktan sonra atılmış olan öğesini kullanarak sınıfının yeni bir örneğini başlatır.Initializes a new instance of the HttpClient class using a HttpClientHandler that is disposed when this instance is disposed.

HttpClient(HttpMessageHandler)

HttpClientBelirtilen işleyici ile sınıfın yeni bir örneğini başlatır.Initializes a new instance of the HttpClient class with the specified handler. Bu örnek atıldığı zaman işleyici atılmış olur.The handler is disposed when this instance is disposed.

HttpClient(HttpMessageHandler, Boolean)

HttpClientBelirtilen işleyici ile sınıfının yeni bir örneğini başlatır ve bu örnek atıldıktan sonra işleyicinin atılıp atılmayacağını belirtir.Initializes a new instance of the HttpClient class with the provided handler, and specifies whether that handler should be disposed when this instance is disposed.

Özellikler

BaseAddress

İstek gönderirken kullanılan Internet kaynağının Tekdüzen Kaynak tanımlayıcısı 'nın (URI) temel adresini alır veya ayarlar.Gets or sets the base address of Uniform Resource Identifier (URI) of the Internet resource used when sending requests.

DefaultProxy

Genel http proxy 'sini alır veya ayarlar.Gets or sets the global Http proxy.

DefaultRequestHeaders

Her istekle birlikte gönderilmesi gereken üst bilgileri alır.Gets the headers which should be sent with each request.

DefaultRequestVersion

Bu örnek tarafından yapılan sonraki isteklerde kullanılan varsayılan HTTP sürümünü alır veya ayarlar HttpClient .Gets or sets the default HTTP version used on subsequent requests made by this HttpClient instance.

DefaultVersionPolicy

, Ve gibi kolay yöntemlerde, örtük olarak oluşturulan istekler için varsayılan sürüm ilkesini alır veya ayarlar GetAsync(String) PostAsync(String, HttpContent) .Gets or sets the default version policy for implicitly created requests in convenience methods, for example, GetAsync(String) and PostAsync(String, HttpContent).

MaxResponseContentBufferSize

Yanıt içeriğini okurken arabelleğe eklenecek en fazla bayt sayısını alır veya ayarlar.Gets or sets the maximum number of bytes to buffer when reading the response content.

Timeout

İstek zaman aşımına uğramadan önce beklenecek TimeSpan değeri alır veya ayarlar.Gets or sets the timespan to wait before the request times out.

Yöntemler

CancelPendingRequests()

Bu örnekteki bekleyen tüm istekleri iptal et.Cancel all pending requests on this instance.

DeleteAsync(String)

Belirtilen URI 'ye bir DELETE isteği zaman uyumsuz bir işlem olarak gönderin.Send a DELETE request to the specified Uri as an asynchronous operation.

DeleteAsync(String, CancellationToken)

Zaman uyumsuz bir işlem olarak, bir iptal belirteci ile belirtilen URI 'ye SILME isteği gönderin.Send a DELETE request to the specified Uri with a cancellation token as an asynchronous operation.

DeleteAsync(Uri)

Belirtilen URI 'ye bir DELETE isteği zaman uyumsuz bir işlem olarak gönderin.Send a DELETE request to the specified Uri as an asynchronous operation.

DeleteAsync(Uri, CancellationToken)

Zaman uyumsuz bir işlem olarak, bir iptal belirteci ile belirtilen URI 'ye SILME isteği gönderin.Send a DELETE request to the specified Uri with a cancellation token as an asynchronous operation.

Dispose()

Yönetilmeyen kaynakları serbest bırakır ve tarafından kullanılan yönetilen kaynakları ortadan kaldırlar HttpMessageInvoker .Releases the unmanaged resources and disposes of the managed resources used by the HttpMessageInvoker.

(Devralındığı yer: HttpMessageInvoker)
Dispose(Boolean)

Yönetilen kaynakların ve isteğe bağlı olarak tarafından kullanılan yönetilmeyen kaynakları serbest bırakır HttpClient .Releases the unmanaged resources used by the HttpClient and optionally disposes of the managed resources.

Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.Determines whether the specified object is equal to the current object.

(Devralındığı yer: Object)
GetAsync(String)

Belirtilen URI 'ye bir GET isteği zaman uyumsuz bir işlem olarak gönderin.Send a GET request to the specified Uri as an asynchronous operation.

GetAsync(String, CancellationToken)

Zaman uyumsuz bir işlem olarak, belirtilen URI 'ye bir iptal belirteci ile GET isteği gönderin.Send a GET request to the specified Uri with a cancellation token as an asynchronous operation.

GetAsync(String, HttpCompletionOption)

Bir HTTP tamamlama seçeneğiyle belirtilen URI 'ye bir GET isteği zaman uyumsuz bir işlem olarak gönderin.Send a GET request to the specified Uri with an HTTP completion option as an asynchronous operation.

GetAsync(String, HttpCompletionOption, CancellationToken)

Belirtilen URI 'ye HTTP tamamlama seçeneği ve iptal belirteci zaman uyumsuz bir işlem olarak bir GET isteği gönderin.Send a GET request to the specified Uri with an HTTP completion option and a cancellation token as an asynchronous operation.

GetAsync(Uri)

Belirtilen URI 'ye bir GET isteği zaman uyumsuz bir işlem olarak gönderin.Send a GET request to the specified Uri as an asynchronous operation.

GetAsync(Uri, CancellationToken)

Zaman uyumsuz bir işlem olarak, belirtilen URI 'ye bir iptal belirteci ile GET isteği gönderin.Send a GET request to the specified Uri with a cancellation token as an asynchronous operation.

GetAsync(Uri, HttpCompletionOption)

Bir HTTP tamamlama seçeneğiyle belirtilen URI 'ye bir GET isteği zaman uyumsuz bir işlem olarak gönderin.Send a GET request to the specified Uri with an HTTP completion option as an asynchronous operation.

GetAsync(Uri, HttpCompletionOption, CancellationToken)

Belirtilen URI 'ye HTTP tamamlama seçeneği ve iptal belirteci zaman uyumsuz bir işlem olarak bir GET isteği gönderin.Send a GET request to the specified Uri with an HTTP completion option and a cancellation token as an asynchronous operation.

GetByteArrayAsync(String)

Belirtilen URI 'ye bir GET isteği gönderir ve yanıt gövdesini bir bayt dizisi olarak zaman uyumsuz bir işlemde döndürür.Sends a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.

GetByteArrayAsync(String, CancellationToken)

Belirtilen URI 'ye bir GET isteği gönderir ve yanıt gövdesini bir bayt dizisi olarak zaman uyumsuz bir işlemde döndürür.Sends a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.

GetByteArrayAsync(Uri)

Belirtilen URI 'ye bir GET isteği gönderin ve yanıt gövdesini bir bayt dizisi olarak zaman uyumsuz bir işlemde döndürün.Send a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.

GetByteArrayAsync(Uri, CancellationToken)

Belirtilen URI 'ye bir GET isteği gönderin ve yanıt gövdesini bir bayt dizisi olarak zaman uyumsuz bir işlemde döndürün.Send a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.

GetHashCode()

Varsayılan karma işlevi olarak işlev görür.Serves as the default hash function.

(Devralındığı yer: Object)
GetStreamAsync(String)

Belirtilen URI 'ye bir GET isteği gönderin ve yanıt gövdesini zaman uyumsuz bir işlemde akış olarak döndürün.Send a GET request to the specified Uri and return the response body as a stream in an asynchronous operation.

GetStreamAsync(String, CancellationToken)

Belirtilen URI 'ye bir GET isteği gönderin ve yanıt gövdesini zaman uyumsuz bir işlemde akış olarak döndürün.Send a GET request to the specified Uri and return the response body as a stream in an asynchronous operation.

GetStreamAsync(Uri)

Belirtilen URI 'ye bir GET isteği gönderin ve yanıt gövdesini zaman uyumsuz bir işlemde akış olarak döndürün.Send a GET request to the specified Uri and return the response body as a stream in an asynchronous operation.

GetStreamAsync(Uri, CancellationToken)

Belirtilen URI 'ye bir GET isteği gönderin ve yanıt gövdesini zaman uyumsuz bir işlemde akış olarak döndürün.Send a GET request to the specified Uri and return the response body as a stream in an asynchronous operation.

GetStringAsync(String)

Belirtilen URI 'ye bir GET isteği gönderin ve yanıt gövdesini zaman uyumsuz bir işlemde dize olarak döndürün.Send a GET request to the specified Uri and return the response body as a string in an asynchronous operation.

GetStringAsync(String, CancellationToken)

Belirtilen URI 'ye bir GET isteği gönderin ve yanıt gövdesini zaman uyumsuz bir işlemde dize olarak döndürün.Send a GET request to the specified Uri and return the response body as a string in an asynchronous operation.

GetStringAsync(Uri)

Belirtilen URI 'ye bir GET isteği gönderin ve yanıt gövdesini zaman uyumsuz bir işlemde dize olarak döndürün.Send a GET request to the specified Uri and return the response body as a string in an asynchronous operation.

GetStringAsync(Uri, CancellationToken)

Belirtilen URI 'ye bir GET isteği gönderin ve yanıt gövdesini zaman uyumsuz bir işlemde dize olarak döndürün.Send a GET request to the specified Uri and return the response body as a string in an asynchronous operation.

GetType()

TypeGeçerli örneği alır.Gets the Type of the current instance.

(Devralındığı yer: Object)
MemberwiseClone()

Geçerli bir basit kopyasını oluşturur Object .Creates a shallow copy of the current Object.

(Devralındığı yer: Object)
PatchAsync(String, HttpContent)

Zaman uyumsuz bir işlem olarak bir dize olarak belirlenmiş bir URI 'ye PATCH isteği gönderir.Sends a PATCH request to a Uri designated as a string as an asynchronous operation.

PatchAsync(String, HttpContent, CancellationToken)

Zaman uyumsuz bir işlem olarak bir dize olarak temsil edilen URI 'ye iptal belirtecine sahip bir PATCH isteği gönderir.Sends a PATCH request with a cancellation token to a Uri represented as a string as an asynchronous operation.

PatchAsync(Uri, HttpContent)

Bir yama isteğini zaman uyumsuz bir işlem olarak gönderir.Sends a PATCH request as an asynchronous operation.

PatchAsync(Uri, HttpContent, CancellationToken)

Zaman uyumsuz bir işlem olarak iptal belirtecine sahip bir yama isteği gönderir.Sends a PATCH request with a cancellation token as an asynchronous operation.

PostAsync(String, HttpContent)

Belirtilen URI 'ye bir POST isteği zaman uyumsuz bir işlem olarak gönderin.Send a POST request to the specified Uri as an asynchronous operation.

PostAsync(String, HttpContent, CancellationToken)

Zaman uyumsuz bir işlem olarak iptal belirtecine sahip bir POST isteği gönderin.Send a POST request with a cancellation token as an asynchronous operation.

PostAsync(Uri, HttpContent)

Belirtilen URI 'ye bir POST isteği zaman uyumsuz bir işlem olarak gönderin.Send a POST request to the specified Uri as an asynchronous operation.

PostAsync(Uri, HttpContent, CancellationToken)

Zaman uyumsuz bir işlem olarak iptal belirtecine sahip bir POST isteği gönderin.Send a POST request with a cancellation token as an asynchronous operation.

PutAsync(String, HttpContent)

Belirtilen URI 'ye bir PUT isteği zaman uyumsuz bir işlem olarak gönderin.Send a PUT request to the specified Uri as an asynchronous operation.

PutAsync(String, HttpContent, CancellationToken)

Zaman uyumsuz bir işlem olarak iptal belirtecine sahip bir PUT isteği gönderin.Send a PUT request with a cancellation token as an asynchronous operation.

PutAsync(Uri, HttpContent)

Belirtilen URI 'ye bir PUT isteği zaman uyumsuz bir işlem olarak gönderin.Send a PUT request to the specified Uri as an asynchronous operation.

PutAsync(Uri, HttpContent, CancellationToken)

Zaman uyumsuz bir işlem olarak iptal belirtecine sahip bir PUT isteği gönderin.Send a PUT request with a cancellation token as an asynchronous operation.

Send(HttpRequestMessage)

Belirtilen istekle bir HTTP isteği gönderir.Sends an HTTP request with the specified request.

Send(HttpRequestMessage, CancellationToken)

Belirtilen istek ve iptal belirtecine sahip bir HTTP isteği gönderir.Sends an HTTP request with the specified request and cancellation token.

Send(HttpRequestMessage, CancellationToken)

Belirtilen istek ve iptal belirtecine sahip bir HTTP isteği gönderir.Sends an HTTP request with the specified request and cancellation token.

(Devralındığı yer: HttpMessageInvoker)
Send(HttpRequestMessage, HttpCompletionOption)

Bir HTTP isteği gönderir.Sends an HTTP request.

Send(HttpRequestMessage, HttpCompletionOption, CancellationToken)

Belirtilen istek, tamamlama seçeneği ve iptal belirtecine sahip bir HTTP isteği gönderir.Sends an HTTP request with the specified request, completion option and cancellation token.

SendAsync(HttpRequestMessage)

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.

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, HttpCompletionOption, CancellationToken)

Bir HTTP isteğini zaman uyumsuz bir işlem olarak gönderin.Send an HTTP request as an asynchronous operation.

ToString()

Geçerli nesneyi temsil eden dizeyi döndürür.Returns a string that represents the current object.

(Devralındığı yer: Object)

Uzantı Metotları

GetFromJsonAsync(HttpClient, String, Type, JsonSerializerOptions, CancellationToken)

Belirtilen URI 'ye bir GET isteği gönderir ve yanıt gövdesinin, zaman uyumsuz bir işlemde JSON olarak serisini kaldırmada elde edilen değeri döndürür.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

GetFromJsonAsync(HttpClient, String, Type, CancellationToken)

Belirtilen URI 'ye bir GET isteği gönderir ve yanıt gövdesinin, zaman uyumsuz bir işlemde JSON olarak serisini kaldırmada elde edilen değeri döndürür.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

GetFromJsonAsync(HttpClient, Uri, Type, JsonSerializerOptions, CancellationToken)

Belirtilen URI 'ye bir GET isteği gönderir ve yanıt gövdesinin, zaman uyumsuz bir işlemde JSON olarak serisini kaldırmada elde edilen değeri döndürür.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

GetFromJsonAsync(HttpClient, Uri, Type, CancellationToken)

Belirtilen URI 'ye bir GET isteği gönderir ve yanıt gövdesinin, zaman uyumsuz bir işlemde JSON olarak serisini kaldırmada elde edilen değeri döndürür.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

GetFromJsonAsync<TValue>(HttpClient, String, JsonSerializerOptions, CancellationToken)

Belirtilen URI 'ye bir GET isteği gönderir ve yanıt gövdesinin, zaman uyumsuz bir işlemde JSON olarak serisini kaldırmada elde edilen değeri döndürür.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

GetFromJsonAsync<TValue>(HttpClient, String, CancellationToken)

Belirtilen URI 'ye bir GET isteği gönderir ve yanıt gövdesinin, zaman uyumsuz bir işlemde JSON olarak serisini kaldırmada elde edilen değeri döndürür.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

GetFromJsonAsync<TValue>(HttpClient, Uri, JsonSerializerOptions, CancellationToken)

Belirtilen URI 'ye bir GET isteği gönderir ve yanıt gövdesinin, zaman uyumsuz bir işlemde JSON olarak serisini kaldırmada elde edilen değeri döndürür.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

GetFromJsonAsync<TValue>(HttpClient, Uri, CancellationToken)

Belirtilen URI 'ye bir GET isteği gönderir ve yanıt gövdesinin, zaman uyumsuz bir işlemde JSON olarak serisini kaldırmada elde edilen değeri döndürür.Sends a GET request to the specified Uri and returns the value that results from deserializing the response body as JSON in an asynchronous operation.

PostAsJsonAsync<TValue>(HttpClient, String, TValue, JsonSerializerOptions, CancellationToken)

valueİstek gövdesinde seri hale GETIRILMIŞ JSON olarak içeren belirtilen URI 'ye BIR post isteği gönderir.Sends a POST request to the specified Uri containing the value serialized as JSON in the request body.

PostAsJsonAsync<TValue>(HttpClient, String, TValue, CancellationToken)

valueİstek gövdesinde seri hale GETIRILMIŞ JSON olarak içeren belirtilen URI 'ye BIR post isteği gönderir.Sends a POST request to the specified Uri containing the value serialized as JSON in the request body.

PostAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonSerializerOptions, CancellationToken)

valueİstek gövdesinde seri hale GETIRILMIŞ JSON olarak içeren belirtilen URI 'ye BIR post isteği gönderir.Sends a POST request to the specified Uri containing the value serialized as JSON in the request body.

PostAsJsonAsync<TValue>(HttpClient, Uri, TValue, CancellationToken)

valueİstek gövdesinde seri hale GETIRILMIŞ JSON olarak içeren belirtilen URI 'ye BIR post isteği gönderir.Sends a POST request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonSerializerOptions, CancellationToken)

valueİstek gövdesinde seri hale GETIRILMIŞ JSON olarak içeren belirtilen URI 'ye BIR PUT isteği gönderin.Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, String, TValue, CancellationToken)

valueİstek gövdesinde seri hale GETIRILMIŞ JSON olarak içeren belirtilen URI 'ye BIR PUT isteği gönderin.Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonSerializerOptions, CancellationToken)

valueİstek gövdesinde seri hale GETIRILMIŞ JSON olarak içeren belirtilen URI 'ye BIR PUT isteği gönderin.Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, CancellationToken)

valueİstek gövdesinde seri hale GETIRILMIŞ JSON olarak içeren belirtilen URI 'ye BIR PUT isteği gönderin.Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

Şunlara uygulanır