我一直在環顧四周,找不到有關獲取此度量標準的簡明示例。我已經安裝了WindowsAzure.Management.Compute
,現在我不知道從哪裏開始。如何才能做到這一點?用C獲取Azure Web應用程序的實例數量#
回答
我建議你看看Azure資源管理器:https://resources.azure.com。你能找到的情況下,請求URL如下:
對於Authorization頭,請看看this article。我們可以使用C#HttpRequest來編寫代碼。這是我在陰囊中測試的結果。
端點:
https://management.azure.com/subscriptions/<subscription ID > /resourceGroups/jatestgroup/providers/Microsoft.Web/sites/testcore1/instances?api-version=2015-08-01
結果:
我們可以從響應計算實例號JSO ñ。此外,在這個rest API中,需要很長時間才能在Azure門戶中擴展實例時顯示所有實例。
[更新]
與我的意見,我因與文章測試:http://blog.amitapple.com/post/2014/03/access-specific-instance/#.V9tLKyh95hF
以下是我的結果:
請下載庫在here 。有關Windows Azure管理證書的更多信息,請參閱this article。
這裏是剪斷代碼:
var cert = new X509Certificate2();
cert.Import(Convert.FromBase64String(""));
var _client = new Microsoft.WindowsAzure.Management.WebSites.WebSiteManagementClient(new Microsoft.WindowsAzure.CertificateCloudCredentials("****", cert));
var ids= await _client.WebSites.GetInstanceIdsAsync("EastAsiawebspace", "testcore1");
您無法從Web應用程序的一個實例中獲取實例數。但是,您可以從門戶網站或Azure ARM API(它是Web Hosting Plan對象上的numberOfWorkers
屬性)中獲取它。請注意0不適用於Azure Web App。
我試圖通過C#的一些指標送入我的應用程序 - 其中之一是當前實例計數。我可以在C#中使用Azure ARM Api嗎?如果是這樣,你介意提供一個如何獲得這些信息的例子嗎? – SB2055
- 1. 獲取Azure Web應用程序實例ID的
- 2. Azure的Web應用程序實例
- 3. 使用C#獲取Excel應用程序的實例處理
- 4. Azure Web應用程序實例中的安全
- 5. Azure Web應用程序 - 阻止路由到特定實例
- 6. Azure Web應用程序中的三層Web應用程序
- 7. Azure的Web應用程序WAAD到Web應用程序訪問
- 8. 獲取Azure應用程序的authenticode
- 9. Azure示例應用程序
- 10. Python web應用程序部署多個應用程序實例
- 11. 從android中的處理程序獲取應用程序實例
- 12. C#Web應用程序中的常量
- 13. 如何獲取當前數量的谷歌應用程序引擎實例?
- 14. 在Web應用程序中獲取Azure角色
- 15. 在代碼中獲取Azure Web應用程序名稱
- 16. 獲取Azure Web應用程序以顯示php錯誤
- 17. Azure瓶應用程序獲取錯誤
- 18. 應用程序日誌azure web應用程序的最佳實踐?
- 19. 遠程調試 - Web應用程序Azure
- 20. 將Azure函數作爲C#Web應用程序調試
- 21. Azure Web應用程序中的MaxConnections?
- 22. SCM_REPOSITORY_PATH在Azure上的Web應用程序
- 23. Windows Azure的Web應用程序託管
- 24. HTTP 502從Azure的Web應用程序
- 25. Azure的web應用程序ConfigurationManager.AppSettings爲空
- 26. 規模Azure的Web應用程序
- 27. 使用C#管理Azure Web應用程序的域名
- 28. 在Azure應用程序服務中測試Web應用程序的多個實例
- 29. Web應用程序實用程序類
- 30. 從Azure實例獲取ServiceDefinition.csdef
是否有SDK支持?我正在尋找的是簡單的 - 「C#實例計數」 – SB2055
當我通過Microsoft.Azure.Management.Websites獲取該網站時。 site.SiteConfig爲空。我無法從此程序集中獲得NumberOfWorkers(此程序集是最新版本)。我建議你試試我的方法。這比使用C#SDK更容易。如果您有特殊情況,歡迎創建新線程。 –
感謝您的幫助。 – SB2055