0
Rackspace Cloud API에 액세스하고 있습니다.'identity.api.rackspacecloud.com'randomly throws '원격 이름을 확인할 수 없습니다.'예외
랙 공간 클라우드에서 나를 인증하는 하나의 API 호출이 있습니다.
방법은 때때로, 그러나, 완벽하게 작동, 난 무작위로,이 예외를 얻을 :
The remote name could not be resolved: 'identity.api.rackspacecloud.com'
내가이 예외를 받고 있지 않다, 방법으로, 예상 된 결과를 반환 그것은해야한다.
왜 이렇게하는 특별한 이유가 있습니까? 이것은 확실히 DNS 오류 같은 소리
private async Task<XDocument> AuthenticateAsync()
{
XNamespace ns = "http://docs.rackspace.com/identity/api/ext/RAX-KSKEY/v1.0";
XDocument doc =
new XDocument(
new XDeclaration("1.0", "UTF-8", "Yes"),
new XElement("auth",
new XElement(ns + "apiKeyCredentials",
new XAttribute("username", "the userName"),
new XAttribute("apiKey", "the apiKey")
)
)
);
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml"));
StringContent content = new StringContent(doc.ToString(), Encoding.UTF8, "application/xml");
// i randomly get "The remote name could not be resolved" exception
HttpResponseMessage response = await client.PostAsync("https://identity.api.rackspacecloud.com/v2.0/tokens", content);
response.EnsureSuccessStatusCode();
string stringResponse = await response.Content.ReadAsStringAsync();
return XDocument.Parse(stringResponse);
}
}
흠, 실제로 다른 많은 URL을 무작위로 거부하는 라우터의 버그 일 수 있다고 생각합니다. – Catalin
사이드 노드로 [official .NET SDK] (https : //developer.rackspace)를 사용하는 것이 더 편리 할 수 있습니다. .com/sdks/dot-net /)를 사용하는 것이 좋습니다. –
@AshWilson 이것은 내가 시작한 곳이지만 비동기로 작동하도록하는 방법을 찾을 수 없습니다. 그러나 문제는 랙 공간에서 발생하는 것이 아닙니다. – Catalin