繁体   English   中英

Azure WebApp 在尝试通过 xyz.azurewebsites.net 访问时抛出 502 页面错误

[英]Azure WebApp throws 502 page error when trying to access over xyz.azurewebsites.net

我目前正在为网站构建后端。 我使用 Java/Spring boot 来构建我的后端,我试图将它托管在 Azure 上。 我从 GitHub 连接了我的主分支,所以每次我们合并到主分支时,更改都是实时的。 我托管了几个星期,没有任何问题。 突然之间,应用程序停止工作,我们无法访问它(尽管 Azure 说它已启动并正在运行)。 如果我尝试访问我的后端,它需要永远加载,最终我会得到一个 502 Http 错误或“指定的 CGI 应用程序遇到错误并且服务器终止了进程。”。 我查了一下,问题不在于我们用尽了订阅/服务计划。 我在本地启动了应用程序,效果很好。 这使我得出结论,问题一定是 Azure,但没有显示任何错误。 我不知道如何解决这个问题,也没有在任何地方找到任何解决方案。 也许你可以帮助我。 提前致谢

朱利叶斯

在尝试任何事情之前,请尝试按照@Josh Van de Walle 提到的那样重新启动应用程序,如果这不起作用,那么您可以尝试以下几种解决方法:-

Azure 网站中有一个名为 Azure 自动修复的功能。 应用程序问题,例如错误状态代码集群、缓慢的请求或过多的 memory 消耗,我们可以使用 AutoHeal,它将触发器与自动操作联系起来。

这是一个您可以查看的示例:-

<system.webServer>
    <monitoring>
        <triggers>
        
            <!-- Triggers when you have "count" responses matching the configured status within "timeInterval" amount of time -->
            <statusCode>
                <add statusCode="500" subStatusCode="100" win32StatusCode="0" count="10" timeInterval="00:00:30"/>
            </statusCode>
            
            <!-- Triggers when you have "count" number of requests within "timeInterval" amount of time -->
            <requests count="1000" timeInterval="00:10:00"/>

            <!-- Triggers when you have "count" number of requests that take "timeTaken" within "timeInterval" amount of time -->
            <slowRequests timeTaken="00:00:45" count="20" timeInterval="00:02:00" />

            <!-- Triggers when your worker process reaches "privateBytesInKB" kilobytes of private set -->
            <memory privateBytesInKB="800000"/>    
                    
        </triggers>

        <!-- Performs an overlapping recycle of the worker process when a trigger fires -->
        <actions value="Recycle"/>
    </monitoring>
</system.webServer>

另一种解决方法是,您可以尝试通过从https://<your webapp name>.scm.azurewebsites.net/DebugConsole导航到D:\home\LogFiles\从 Kudu 控制台检查日志,以确保原因和工作因此。

还要确保在应用服务中添加WEBSITE_LOAD_USER_PROFILE设置:

WEBSITE_LOAD_USER_PROFILE = 1

参考:

  1. 为您的 Azure Web 站点配置 Azure 自动修复
  2. 在代码中使用 TLS/SSL 证书

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM