【问题标题】:Getting Azure Web App instance id's获取 Azure Web App 实例 ID
【发布时间】:2015-09-07 08:48:05
【问题描述】:

我正在尝试获取 Azure Web 应用程序的实例 ID。我知道该应用程序在 2 个活动实例上运行,但是当我使用 WebSiteManagementClient API 的 GetInstanceIds 时,我只获得 1 个 ID:

var cert = new X509Certificate2();
cert.Import(Convert.FromBase64String("cert_string"));

var client = new WebSiteManagementClient(new CertificateCloudCredentials("id_to_sub", cert));
var instanceIds = client.WebSites.GetInstanceIds("webspace_name", "webapp_name");

我在这里错过了什么?

【问题讨论】:

    标签: asp.net azure


    【解决方案1】:

    我见过类似的行为。在我的测试中,似乎有几个因素:

    • 此 API 不会为“免费”实例返回任何内容
    • 在某些情况下,每个实例都需要几分钟才能启动
    • 在某些情况下,“WEBSITE_INSTANCE_ID”环境变量会返回此 API 结果中未列出的值。

    根据您的描述,我认为第二项是最有可能出现的问题。尝试打开“始终开启”并点击该网站几次,然后查看结果。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-25
      • 1970-01-01
      • 2016-12-09
      • 2017-08-29
      • 2022-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多