好的,所以这个谷歌完全被难住了。有没有人有 WebClient.OpenWriteTaskAsync 的示例,您还可以在其中阅读响应?我了解如何编写请求并处理异常情况,但我不知道如何阅读响应。
try
{
using (var stream = await client.OpenWriteTaskAsync(url,method))
{
new XmlSerializer(sometype).Serialize(someobject,stream);
}
// at this point the request has been sent - how to get at the response data?
}
catch (WebException wex)
{
// handle exception
}