HttpClient.PutAsync HttpClient.PutAsync HttpClient.PutAsync HttpClient.PutAsync Method

Definition

以异步操作将 PUT 请求发送给指定 URI。 Send a PUT request to the specified Uri as an asynchronous operation.

Overloads

PutAsync(String, HttpContent) PutAsync(String, HttpContent) PutAsync(String, HttpContent) PutAsync(String, HttpContent)

以异步操作将 PUT 请求发送给指定 URI。 Send a PUT request to the specified Uri as an asynchronous operation.

PutAsync(Uri, HttpContent) PutAsync(Uri, HttpContent) PutAsync(Uri, HttpContent) PutAsync(Uri, HttpContent)

以异步操作将 PUT 请求发送给指定 URI。 Send a PUT request to the specified Uri as an asynchronous operation.

PutAsync(String, HttpContent, CancellationToken) PutAsync(String, HttpContent, CancellationToken) PutAsync(String, HttpContent, CancellationToken)

用以异步操作的取消标记发送 PUT 请求。 Send a PUT request with a cancellation token as an asynchronous operation.

PutAsync(Uri, HttpContent, CancellationToken) PutAsync(Uri, HttpContent, CancellationToken) PutAsync(Uri, HttpContent, CancellationToken)

用以异步操作的取消标记发送 PUT 请求。 Send a PUT request with a cancellation token as an asynchronous operation.

Remarks

不会阻止此操作。This operation will not block.

PutAsync(String, HttpContent) PutAsync(String, HttpContent) PutAsync(String, HttpContent) PutAsync(String, HttpContent)

以异步操作将 PUT 请求发送给指定 URI。 Send a PUT request to the specified Uri as an asynchronous operation.

public:
 System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ PutAsync(System::String ^ requestUri, System::Net::Http::HttpContent ^ content);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsync (string requestUri, System.Net.Http.HttpContent content);
member this.PutAsync : string * System.Net.Http.HttpContent -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
Public Function PutAsync (requestUri As String, content As HttpContent) As Task(Of HttpResponseMessage)

参数

requestUri
String String String String

请求发送到的 URI。 The Uri the request is sent to.

content
HttpContent HttpContent HttpContent HttpContent

发送到服务器的 HTTP 请求内容。 The HTTP request content sent to the server.

Returns

表示异步操作的任务对象。 The task object representing the asynchronous operation.

Exceptions

由于基础问题(如网络连接性、DNS 失败、服务器证书验证或超时),请求失败。 The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout.

Remarks

不会阻止此操作。This operation will not block. 返回Task<TResult>读取 (包括内容) 的整个响应后,将完成对象。The returned Task<TResult> object will complete after the whole response (including content) is read.

PutAsync(Uri, HttpContent) PutAsync(Uri, HttpContent) PutAsync(Uri, HttpContent) PutAsync(Uri, HttpContent)

以异步操作将 PUT 请求发送给指定 URI。 Send a PUT request to the specified Uri as an asynchronous operation.

public:
 System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ PutAsync(Uri ^ requestUri, System::Net::Http::HttpContent ^ content);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsync (Uri requestUri, System.Net.Http.HttpContent content);
member this.PutAsync : Uri * System.Net.Http.HttpContent -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
Public Function PutAsync (requestUri As Uri, content As HttpContent) As Task(Of HttpResponseMessage)

参数

requestUri
Uri Uri Uri Uri

请求发送到的 URI。 The Uri the request is sent to.

content
HttpContent HttpContent HttpContent HttpContent

发送到服务器的 HTTP 请求内容。 The HTTP request content sent to the server.

Returns

表示异步操作的任务对象。 The task object representing the asynchronous operation.

Exceptions

由于基础问题(如网络连接性、DNS 失败、服务器证书验证或超时),请求失败。 The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout.

Remarks

不会阻止此操作。This operation will not block. 返回Task<TResult>读取 (包括内容) 的整个响应后,将完成对象。The returned Task<TResult> object will complete after the whole response (including content) is read.

PutAsync(String, HttpContent, CancellationToken) PutAsync(String, HttpContent, CancellationToken) PutAsync(String, HttpContent, CancellationToken)

用以异步操作的取消标记发送 PUT 请求。 Send a PUT request with a cancellation token as an asynchronous operation.

public:
 System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ PutAsync(System::String ^ requestUri, System::Net::Http::HttpContent ^ content, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsync (string requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken);
member this.PutAsync : string * System.Net.Http.HttpContent * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>

参数

requestUri
String String String String

请求发送到的 URI。 The Uri the request is sent to.

content
HttpContent HttpContent HttpContent HttpContent

发送到服务器的 HTTP 请求内容。 The HTTP request content sent to the server.

cancellationToken
CancellationToken CancellationToken CancellationToken CancellationToken

可由其他对象或线程用以接收取消通知的取消标记。 A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

表示异步操作的任务对象。 The task object representing the asynchronous operation.

Exceptions

由于基础问题(如网络连接性、DNS 失败、服务器证书验证或超时),请求失败。 The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout.

Remarks

不会阻止此操作。This operation will not block. 返回Task<TResult>读取 (包括内容) 的整个响应后,将完成对象。The returned Task<TResult> object will complete after the whole response (including content) is read.

PutAsync(Uri, HttpContent, CancellationToken) PutAsync(Uri, HttpContent, CancellationToken) PutAsync(Uri, HttpContent, CancellationToken)

用以异步操作的取消标记发送 PUT 请求。 Send a PUT request with a cancellation token as an asynchronous operation.

public:
 System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ PutAsync(Uri ^ requestUri, System::Net::Http::HttpContent ^ content, System::Threading::CancellationToken cancellationToken);
public System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsync (Uri requestUri, System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken);
member this.PutAsync : Uri * System.Net.Http.HttpContent * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>

参数

requestUri
Uri Uri Uri Uri

请求发送到的 URI。 The Uri the request is sent to.

content
HttpContent HttpContent HttpContent HttpContent

发送到服务器的 HTTP 请求内容。 The HTTP request content sent to the server.

cancellationToken
CancellationToken CancellationToken CancellationToken CancellationToken

可由其他对象或线程用以接收取消通知的取消标记。 A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

表示异步操作的任务对象。 The task object representing the asynchronous operation.

Exceptions

由于基础问题(如网络连接性、DNS 失败、服务器证书验证或超时),请求失败。 The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout.

Remarks

不会阻止此操作。This operation will not block. 返回Task<TResult>读取 (包括内容) 的整个响应后,将完成对象。The returned Task<TResult> object will complete after the whole response (including content) is read.

Applies to