Skip to content

Commit 1b5873e

Browse files
More changes
1 parent 0579b76 commit 1b5873e

5 files changed

Lines changed: 130 additions & 8 deletions

File tree

support/azure/app-service/app-service-web-nodejs-best-practices-troubleshoot-guide.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
---
22
title: Node.js Best Practices and Troubleshooting Guide
33
description: Learn the best practices and troubleshooting steps for Node.js applications running in Azure App Service.
4-
author: JarrettRenshaw
4+
ms.assetid: 387ea217-7910-4468-8987-9a1022a99bef
55
manager: dcscontentpm
66
ms.topic: best-practice
77
ms.date: 10/13/2025
8-
ms.author: jarrettr
8+
author: msangapu-msft
9+
ms.author: msangapu
910
ms.reviewer: v-ryanberg
1011
ms.service: azure-app-service
12+
ms.custom: devx-track-js
1113
# customer intent: As a developer, I want to learn best practices for Node.js applications that run in App Service so that I can use these apps more effectively.
1214
---
1315
# Best practices and troubleshooting guide for node applications on Azure App Service Windows
107 KB
Loading
12.3 KB
Loading

support/azure/app-service/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
href: ase-migration-faq.yml
3131
- name: FAQs about scaling web apps
3232
href: ./scaling-web-app-faq.yml
33+
- name: Fix HTTP 502 and HTTP 503 Errors
34+
href: troubleshoot-http-502-http-503
3335
- name: Map your own custom domain
3436
href: /azure/app-service/app-service-web-tutorial-custom-domain
3537
- name: Node.js Best Practices and Troubleshooting Guide

support/azure/app-service/troubleshoot-http-502-http-503.md

Lines changed: 124 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,133 @@
11
---
2-
title:
3-
description:
4-
author: JarrettRenshaw
2+
title: Fix HTTP 502 and HTTP 503 Errors
3+
description: Troubleshoot 502 Bad Gateway and 503 Service Unavailable errors in your app hosted in Azure App Service.
4+
tags: top-support-issue
5+
keywords: 502 bad gateway, 503 service unavailable, error 503, error 502
6+
ms.assetid: 51cd331a-a3fa-438f-90ef-385e755e50d5
57
manager: dcscontentpm
6-
ms.topic:
8+
ms.topic: troubleshooting-general
79
ms.service: azure-app-service
810
ms.date: 10/14/2025
9-
ms.author: jarrettr
11+
ms.author: msangapu
12+
author: msangapu-msft
1013
ms.reviewer: v-ryanberg
14+
#customer intent: As an app developer, I need to troubleshoot common errors if they occur using tools provided by Azure App Service.
1115
---
12-
#
16+
# Troubleshoot HTTP 502 and 503 errors in Azure App Service
17+
18+
HTTP "502 Bad Gateway" and "503 Service Unavailable" are common errors that you can get when you open an app that you host in [Azure App Service](/azure/app-service/overview). This article helps you troubleshoot these errors.
19+
20+
If you need more help, you can contact the Azure experts at [Azure Community Support](https://azure.microsoft.com/support/forums/). Or, you can use resources at the [Azure Support site](https://azure.microsoft.com/support/options/).
21+
22+
The cause of these errors is often an application-level problem, such as:
23+
24+
- Requests are taking a long time.
25+
- The app is using high memory or CPU.
26+
- An exception is preventing the app from responding.
27+
28+
Troubleshooting consists of three tasks, in sequential order:
29+
30+
1. Observe and monitor application behavior.
31+
1. Collect data.
32+
1. Mitigate the problem.
33+
34+
App Service gives you options for each task.
35+
36+
<a name="observe"></a>
37+
38+
## Observe and monitor application behavior
39+
40+
Azure App Service provides several ways to observe app behavior.
41+
42+
### Track service health
43+
44+
Azure publicizes service interruptions and performance degradations in App Service. You can track the health of the service in the [Azure portal](https://portal.azure.com/). For more information, see [View service health notifications by using the Azure portal](/azure/service-health/service-notifications).
45+
46+
### Monitor your app
47+
48+
You can monitor your app to find out if it's having any problems. On the Azure portal page for your app, select **Monitoring** > **Metrics**. The **Metric** dropdown menu shows you the metrics that you can add.
49+
50+
Some of the metrics that you might want to monitor for your app are:
51+
52+
- Average memory working set
53+
- CPU time
54+
- Memory working set
55+
- Requests
56+
57+
:::image type="content" source="./media/app-service-web-troubleshoot-HTTP-502-503/1-monitor-metrics.png" alt-text="Screenshot that shows metric options for an app in the portal." lightbox="./media/app-service-web-troubleshoot-HTTP-502-503/1-monitor-metrics.png":::
58+
59+
For more information, see:
60+
61+
- [Azure App Service quotas and metrics](/azure/app-service/web-sites-monitor)
62+
- [What are Azure Monitor alerts?](/azure/azure-monitor/alerts/alerts-overview)
63+
64+
<a name="collect"></a>
65+
66+
## Collect data
67+
68+
Collect data by using diagnostics or the Kudu debug console.
69+
70+
### Use the diagnostics feature
71+
72+
App Service provides an intelligent and interactive experience to help you troubleshoot your app, with no configuration required. The diagnostics feature can discover a problem and guide you to the right information for troubleshooting and resolution.
73+
74+
To access App Service diagnostics, go to your App Service app or App Service Environment in the [Azure portal](https://portal.azure.com). On the left menu, select **Diagnose and solve problems**.
75+
76+
### Use the Kudu debug console
77+
78+
App Service comes with a console that you can use for debugging, exploring, and uploading files. It also provides JSON endpoints that you can use to get information about your environment. This console is part of the Kudu dashboard for your app.
79+
80+
In the Azure portal, go to your app. In the left menu, select **Development Tools** > **Advanced Tools**. Select **Go** to open Kudu in a new browser window.
81+
82+
By default, your app domain includes these elements: `<app-name>`-`<random-hash>`.`<region>`. You can also access the dashboard by going to the link `https://<app-name>-<random-hash>.scm.<region>.azurewebsites.net/`. To get the random hash and region values, in your app **Overview**, copy **Default domain**.
83+
84+
Kudu provides:
85+
86+
- Environment settings for your application.
87+
- A log stream.
88+
- A diagnostic dump.
89+
- The debug console, in which you can run PowerShell cmdlets and basic DOS commands.
90+
91+
If your application is throwing first-chance exceptions, you can use Kudu and the Sysinternals tool ProcDump to create memory dumps. These memory dumps are snapshots of the process and can help you troubleshoot more complicated problems with your app.
92+
93+
For more information on features available in Kudu, see the blog post
94+
[Kudu Dashboard explained - WordPress on App Service](https://techcommunity.microsoft.com/blog/appsonazureblog/kudu-dashboard-explained---wordpress-on-app-service/4030035).
95+
96+
<a name="mitigate"></a>
97+
98+
## Mitigate the problem
99+
100+
Consider these options to address these issues.
101+
102+
### Scale the app
103+
104+
In Azure App Service, for increased performance and throughput, you can adjust the scale at which you run your application. Scaling up an app involves two related actions:
105+
106+
- Changing your App Service plan to a higher pricing tier
107+
- Configuring certain settings after you switch to a higher pricing tier
108+
109+
For more information on scaling, see [Scale an app in Azure App Service](/azure/app-service/manage-scale-up).
110+
111+
You can also choose to run your application on more than one instance. This choice provides you with more processing capability and also gives you some fault tolerance. If the process goes down on one instance, the other instance continues to serve requests.
112+
113+
You can set the scaling to be manual or automatic.
114+
115+
### Use auto-healing
116+
117+
Auto-healing recycles the worker process for your app based on settings that you choose. The settings include configuration changes, requests, memory-based limits, or the time needed to execute a request.
118+
119+
Most of the time, recycling the process is the fastest way to recover from a problem. Though you can always restart the app directly in the Azure portal, auto-healing can do it automatically for you. All you need to do is add some triggers in the root `Web.config` file for your app. These settings work in the same way even if your application isn't a .NET one.
120+
121+
For more information, see [Azure App Service diagnostics overview](/azure/app-service/overview-diagnostics#auto-healing).
122+
123+
### Restart the app
124+
125+
Restarting your app is often the simplest way to recover from one-time problems. On the [Azure portal](https://portal.azure.com/) page for your app, you can stop or restart your app.
126+
127+
:::image type="content" source="./media/app-service-web-troubleshoot-HTTP-502-503/2-restart.png" alt-text="Screenshot that shows options for stopping and restarting an app in the portal.":::
128+
129+
You can also manage your app by using Azure PowerShell. For more information, see
130+
[Manage Azure resources by using Azure PowerShell](/azure/azure-resource-manager/management/manage-resources-powershell).
13131

14132

15133
[!INCLUDE [azure-help-support](~/includes/azure-help-support.md)]

0 commit comments

Comments
 (0)