try
{
using (var client = new HttpClient())
{
var requestUri = "http://[some-vcloud-ipaddress]/api/versions";
var response = await client.GetAsync(requestUri); // <-- This is line 94
if (response.IsSuccessStatusCode)
{
var xml = await response.Content.ReadAsStreamAsync();
var result = Serializer<SupportedVersions>.Deserialize(xml);
return result;
}
return null;
}
}
catch (Exception ex)
{
_logger.ErrorFormat("VcloudApiClient - GetSupportedVersions failed. Error message: {0}", ex.Message);
_logger.ErrorFormat("VcloudApiClient - GetSupportedVersions failed. Error stacktrace: {0}", ex.StackTrace);
throw;
}
以下是错误日志。
VcloudApiClient - GetSupportedVersions failed. Error message: An error occurred while sending the request.
VcloudApiClient - GetSupportedVersions failed. Error stacktrace: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at SomeProject.Tpl.VcloudDirector.VcloudApiClient.<GetSupportedVersions>d__1.MoveNext() in d:\Projects\SomeProject-01\src\Api\SomeProject.Tpl\VcloudDirector\VcloudApiClient.cs:line 94
请注意,在任何其他客户端(浏览器,Postman REST客户端等)上执行URL都没有问题。