You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/app-service/troubleshoot-http-502-http-503.md
+36-28Lines changed: 36 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,62 +6,66 @@ keywords: 502 bad gateway, 503 service unavailable, error 503, error 502
6
6
7
7
ms.assetid: 51cd331a-a3fa-438f-90ef-385e755e50d5
8
8
ms.topic: troubleshooting-general
9
-
ms.date: 07/06/2016
9
+
ms.date: 03/31/2025
10
10
ms.author: msangapu
11
11
author: msangapu-msft
12
+
#customer intent: As an app developer, I need to troubleshoot common errors if they occur using tools provided by Azure App Service.
12
13
---
13
14
14
15
# Troubleshoot HTTP 502 and 503 errors in Azure App Service
15
16
16
-
HTTP "502 Bad Gateway" and "503 Service Unavailable" are common errors that you can get when you try to open your app that's hosted in [Azure App Service](./overview.md). This article helps you troubleshoot these errors.
17
+
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](./overview.md). This article helps you troubleshoot these errors.
17
18
18
-
If you need more help at any point in this article, you can contact the Azure experts on [the MSDN Azure and Stack Overflow forums](https://azure.microsoft.com/support/forums/). Alternatively, you can file an Azure support incident on the [Azure Support site](https://azure.microsoft.com/support/options/) by selecting **Get Support**.
19
+
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/).
19
20
20
21
The cause of these errors is often an application-level problem, such as:
21
22
22
-
* Requests are taking a long time.
23
-
* The app is using high memory or CPU.
24
-
* An exception is preventing the app from responding.
23
+
- Requests are taking a long time.
24
+
- The app is using high memory or CPU.
25
+
- An exception is preventing the app from responding.
25
26
26
27
Troubleshooting consists of three tasks, in sequential order:
27
28
28
29
1. Observe and monitor application behavior.
29
-
2. Collect data.
30
-
3. Mitigate the problem.
30
+
1. Collect data.
31
+
1. Mitigate the problem.
31
32
32
33
App Service gives you options for each task.
33
34
34
35
<aname="observe"></a>
35
36
36
37
## Observe and monitor application behavior
37
38
39
+
Azure App Service provides several ways to observe app behavior.
40
+
38
41
### Track service health
39
42
40
43
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).
41
44
42
45
### Monitor your app
43
46
44
-
You can monitor your app to find out if it's having any problems. On the Azure portal page for your app, select the **Requests and errors** tile. The **Metric**box shows you all the metrics that you can add.
47
+
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.
45
48
46
49
Some of the metrics that you might want to monitor for your app are:
47
50
48
-
* Average memory working set
49
-
* Average response time
50
-
* CPU time
51
-
* Memory working set
52
-
* Requests
51
+
- Average memory working set
52
+
- CPU time
53
+
- Memory working set
54
+
- Requests
53
55
54
-
:::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.":::
56
+
:::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":::
55
57
56
58
For more information, see:
57
59
58
-
*[Azure App Service quotas and metrics](web-sites-monitor.md)
59
-
*[What are Azure Monitor alerts?](/azure/azure-monitor/alerts/alerts-overview)
60
+
-[Azure App Service quotas and metrics](web-sites-monitor.md)
61
+
-[What are Azure Monitor alerts?](/azure/azure-monitor/alerts/alerts-overview)
60
62
61
63
<aname="collect"></a>
62
64
63
65
## Collect data
64
66
67
+
Collect data by using diagnostics or the Kudu debug console.
68
+
65
69
### Use the diagnostics feature
66
70
67
71
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.
@@ -72,16 +76,18 @@ To access App Service diagnostics, go to your App Service app or App Service Env
72
76
73
77
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.
74
78
75
-
You can access the dashboard by going to the link `https://<Your app name>.scm.azurewebsites.net/`.
79
+
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.
80
+
81
+
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**.
76
82
77
83
Kudu provides:
78
84
79
-
* Environment settings for your application.
80
-
* A log stream.
81
-
* A diagnostic dump.
82
-
* The debug console, in which you can run PowerShell cmdlets and basic DOS commands.
85
+
- Environment settings for your application.
86
+
- A log stream.
87
+
- A diagnostic dump.
88
+
- The debug console, in which you can run PowerShell cmdlets and basic DOS commands.
83
89
84
-
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 often help you troubleshoot more complicated problems with your app.
90
+
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.
85
91
86
92
For more information on features available in Kudu, see the blog post
87
93
[Kudu Dashboard explained - WordPress on App Service](https://techcommunity.microsoft.com/blog/appsonazureblog/kudu-dashboard-explained---wordpress-on-app-service/4030035).
@@ -90,30 +96,32 @@ For more information on features available in Kudu, see the blog post
90
96
91
97
## Mitigate the problem
92
98
99
+
Consider these options to address these issues.
100
+
93
101
### Scale the app
94
102
95
103
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:
96
104
97
-
* Changing your App Service plan to a higher pricing tier
98
-
* Configuring certain settings after you switch to a higher pricing tier
105
+
- Changing your App Service plan to a higher pricing tier
106
+
- Configuring certain settings after you switch to a higher pricing tier
99
107
100
108
For more information on scaling, see [Scale an app in Azure App Service](manage-scale-up.md).
101
109
102
-
Additionally, you can choose to run your application on more than one instance. This choice not only provides you with more processing capability but also gives you some amount of fault tolerance. If the process goes down on one instance, the other instance continues to serve requests.
110
+
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.
103
111
104
112
You can set the scaling to be manual or automatic.
105
113
106
114
### Use auto-healing
107
115
108
116
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.
109
117
110
-
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 is not a .NET one.
118
+
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.
111
119
112
120
For more information, see [Azure App Service diagnostics overview](overview-diagnostics.md#auto-healing).
113
121
114
122
### Restart the app
115
123
116
-
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 have the option to stop or restart your app.
124
+
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.
117
125
118
126
:::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.":::
0 commit comments