2011-10-01 MS 버전을 사용하여 REST API를 통해 트래픽 관리자를 만들었습니다.REST API를 통한 Azure Traffic Manager 생성 - 예기치 않은 동작
자원 난 다음 - http://msdn.microsoft.com/en-us/library/windowsazure/hh758254.aspx
교통 관리자가 성공적으로 생성되었다
- 프로필을 만듭니다. 모든 행복.
그러나 30 분이 지나면 트래픽 관리자는 비활성 상태가되고 모든 엔드 포인트는 GONE입니다. 연결된 끝 점이 없음을 보여줍니다.
나는 무슨 일이 일어나고 있는지 잘 모르겠습니다. 그것은 하늘의 문제인가? 또는 REST API 문제입니까? 또는 트래픽 관리자 문제를 만드는 내 방식입니다.
PS는 - 어떤 도움은 매우 극명하게 될 것이다 http://msdn.microsoft.com/en-us/library/windowsazure/gg651127.aspx
- 나는 REST API 호출을 만들기위한이 샘플을 따랐다.
갱신 1
매개 변수
- SubscriptionID - 나는 로컬 인증서 저장소
- endpoint1 도메인 이름에 유효한 인증서 존재를 확인 교차 -
- 인증서 publishsettings에서 유효한 GUID - JASH13.CLOUDAPP.NET
- e ndpoint2 도메인 이름 - JASH23.CLOUDAPP.NET
REST API 호출 수준에는 오류가 없습니다. 모든 것이 매끄럽게 작동했습니다.
프로필 생성 - TM이 비활성 상태에 들어간 후
// X.509 certificate variables. X509Store certStore = null; X509Certificate2Collection certCollection = null; X509Certificate2 certificate = null; // Request and response variables. HttpWebRequest httpWebRequest = null; HttpWebResponse httpWebResponse = null; // Stream variables. Stream responseStream = null; StreamReader reader = null; // URI variable. Uri requestUri = null; // The thumbprint for the certificate. This certificate would have been // previously added as a management certificate within the Windows Azure management portal. string thumbPrint = CertificateThumbprint; // Open the certificate store for the current user. certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser); certStore.Open(OpenFlags.ReadOnly); // Find the certificate with the specified thumbprint. certCollection = certStore.Certificates.Find( X509FindType.FindByThumbprint, thumbPrint, false); // Close the certificate store. certStore.Close(); // Check to see if a matching certificate was found. if (0 == certCollection.Count) { throw new Exception("No certificate found containing thumbprint " + thumbPrint); } // A matching certificate was found. certificate = certCollection[0]; // Create the request. requestUri = new Uri("https://management.core.windows.net/" + SubscriptionId + "/services/WATM/profiles/" + ProfileName + "/definitions"); httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(requestUri); // Add the certificate to the request. httpWebRequest.ClientCertificates.Add(certificate); httpWebRequest.Method = "POST"; httpWebRequest.Headers.Add("x-ms-version", "2011-10-01"); string str = @"<Definition xmlns=""http://schemas.microsoft.com/windowsazure""><DnsOptions><TimeToLiveInSeconds>300</TimeToLiveInSeconds></DnsOptions><Monitors><Monitor><IntervalInSeconds>30</IntervalInSeconds><TimeoutInSeconds>10</TimeoutInSeconds><ToleratedNumberOfFailures>3</ToleratedNumberOfFailures><Protocol>HTTP</Protocol><Port>80</Port><HttpOptions><Verb>GET</Verb><RelativePath>/</RelativePath><ExpectedStatusCode>200</ExpectedStatusCode></HttpOptions></Monitor></Monitors><Policy><LoadBalancingMethod>RoundRobin</LoadBalancingMethod><Endpoints><Endpoint><DomainName>" + PrimaryService + "</DomainName><Status>Enabled</Status></Endpoint><Endpoint><DomainName>" + SecondaryService + "</DomainName><Status>Enabled</Status></Endpoint></Endpoints></Policy></Definition>"; byte[] bodyStart = System.Text.Encoding.UTF8.GetBytes(str.ToString()); Stream dataStream = httpWebRequest.GetRequestStream(); dataStream.Write(bodyStart, 0, str.ToString().Length); // Make the call using the web request. httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); // Parse the web response. responseStream = httpWebResponse.GetResponseStream(); reader = new StreamReader(responseStream); // Close the resources no longer needed. httpWebResponse.Close(); responseStream.Close(); reader.Close();
UPDATE2 , 나는 REST API를 사용하여 프로파일 정의를 확인 창조론자
// X.509 certificate variables. X509Store certStore = null; X509Certificate2Collection certCollection = null; X509Certificate2 certificate = null; // Request and response variables. HttpWebRequest httpWebRequest = null; HttpWebResponse httpWebResponse = null; // Stream variables. Stream responseStream = null; StreamReader reader = null; // URI variable. Uri requestUri = null; // The thumbprint for the certificate. This certificate would have been // previously added as a management certificate within the Windows Azure management portal. string thumbPrint = CertificateThumbprint; // Open the certificate store for the current user. certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser); certStore.Open(OpenFlags.ReadOnly); // Find the certificate with the specified thumbprint. certCollection = certStore.Certificates.Find( X509FindType.FindByThumbprint, thumbPrint, false); // Close the certificate store. certStore.Close(); // Check to see if a matching certificate was found. if (0 == certCollection.Count) { throw new Exception("No certificate found containing thumbprint " + thumbPrint); } // A matching certificate was found. certificate = certCollection[0]; // Create the request. requestUri = new Uri("https://management.core.windows.net/" + SubscriptionId + "/services/WATM/profiles"); httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(requestUri); // Add the certificate to the request. httpWebRequest.ClientCertificates.Add(certificate); httpWebRequest.Method = "POST"; httpWebRequest.Headers.Add("x-ms-version", "2011-10-01"); string str = @"<Profile xmlns=""http://schemas.microsoft.com/windowsazure""><DomainName>" + ProfileDomain + "</DomainName><Name>" + ProfileName + "</Name></Profile>"; byte[] bodyStart = System.Text.Encoding.UTF8.GetBytes(str.ToString()); Stream dataStream = httpWebRequest.GetRequestStream(); dataStream.Write(bodyStart, 0, str.ToString().Length); // Make the call using the web request. httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); // Parse the web response. responseStream = httpWebResponse.GetResponseStream(); reader = new StreamReader(responseStream); // Close the resources no longer needed. httpWebResponse.Close(); responseStream.Close(); reader.Close();
정의. 거기에서 나는 어떤 종점을 찾을 수 없었다. 그들은 실종되었다.
<Definitions xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Definition> <DnsOptions> <TimeToLiveInSeconds>300</TimeToLiveInSeconds> </DnsOptions> <Status>Enabled</Status> <Version>1</Version> <Monitors> <Monitor> <IntervalInSeconds>30</IntervalInSeconds> <TimeoutInSeconds>10</TimeoutInSeconds> <ToleratedNumberOfFailures>3</ToleratedNumberOfFailures> <Protocol>HTTP</Protocol> <Port>80</Port> <HttpOptions> <Verb>GET</Verb> <RelativePath>/</RelativePath> <ExpectedStatusCode>200</ExpectedStatusCode> </HttpOptions> </Monitor> </Monitors> <Policy> <LoadBalancingMethod>Performance</LoadBalancingMethod> <Endpoints/> <MonitorStatus>Inactive</MonitorStatus> </Policy> </Definition> </Definitions>
갱신 3이 산발적으로 동작 만 특정 클라우드 서비스 및 TM 프로파일/definitiona에 무슨 일이 일어나고 . 클라우드 서비스와 TM 프로파일의 새로운 세트를 만들면 모든 것이 잘 작동하는 것 같습니다. 나는 이것을 여러 번 시험했다. 따라서 유일한 문제는 다음과 같은 매개 변수에 있습니다.
- endpoint1 도메인 이름 - JASH13.CLOUDAPP.NET
- endpoint2 도메인 이름 -JASH23.CLOUDAPP.NET
- TM 도메인 - ramitm.trafficmanager.net
- TM의 프로파일 이름 - ramitm
몇 가지 코드를 공유하십시오. –
@ GauravMantri, 위에 코드를 추가했습니다. – ramiramilu
@ramiramilu는 작성한 WATM 프로파일에 대한 정보를 공유 할 수 있습니까? WATM URL 또는 cloudapp.net URL 중 하나가 유용 할 것입니다. 내부 로그에서이 정보를 조회하고 어떤 일이 있었는지 확인할 수 있습니다. – kwill