【问题标题】:Azure 502 web server received an invalid response while acting as a gatewayAzure 502 Web 服务器在充当网关时收到无效响应
【发布时间】:2015-01-13 08:22:31
【问题描述】:

我的页面开始出现随机 502 错误。这与 Azure 或我的网站有关吗?自星期四以来我没有做任何更改,所以我对成为我的代码有点怀疑。

502 - Web server received an invalid response while acting as a gateway or proxy server. There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.

我正在检查日志,但它只说它发生在哪个 url,它发生在主根页面上。

【问题讨论】:

  • 哦不,这里也一样。我想知道那是不是Azure?

标签: azure


【解决方案1】:

在我的情况下,这是因为代码中的无限循环而发生的,该循环仅在生产中触发,而不是在我的本地计算机上触发。修复无限循环显然修复了 502。;-)

更新:无限循环的元示例(C#)。

public IList<Model> PropertyOne
{
    get
    {
        return !_productionOnlyCondition ? _models.ToList() : PropertyTwo;
    }
}

public IList<Model> PropertyTwo
{
    get
    {
        return PropertyOne.Where(model => model.Condition).ToList();
    }
}

【讨论】:

  • 你能举个你做过的无限循环的例子吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-17
  • 2019-05-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多