HTTP 503
cloud
resource_error
ai_generated
true
System.Net.Http.HttpRequestException: The connection limit for the host was exceeded
ID: cloud/azure-app-service-connection-limit-exceeded
82%Fix Rate
82%Confidence
1Evidence
2024-06-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Azure App Service Windows 2022 | active | — | — | — |
| .NET 8.0 | active | — | — | — |
Root Cause
Azure App Service plan has a default connection limit (e.g., 300 per instance) that is exhausted due to insufficient scaling or long-lived connections.
generic中文
Azure应用服务计划有默认连接限制(如每个实例300个),因扩展不足或长连接耗尽。
Official Documentation
https://learn.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs#connection-limitsWorkarounds
-
85% success Scale out the App Service plan to more instances (e.g., increase instance count from 1 to 3) to distribute connections
Scale out the App Service plan to more instances (e.g., increase instance count from 1 to 3) to distribute connections
-
80% success Enable Always On in App Service settings to prevent idle connection drops and reduce churn
Enable Always On in App Service settings to prevent idle connection drops and reduce churn
-
75% success Set `ServicePointManager.DefaultConnectionLimit = int.MaxValue` in Global.asax.cs to increase outbound connection limit (if error is outbound)
Set `ServicePointManager.DefaultConnectionLimit = int.MaxValue` in Global.asax.cs to increase outbound connection limit (if error is outbound)
中文步骤
Scale out the App Service plan to more instances (e.g., increase instance count from 1 to 3) to distribute connections
Enable Always On in App Service settings to prevent idle connection drops and reduce churn
Set `ServicePointManager.DefaultConnectionLimit = int.MaxValue` in Global.asax.cs to increase outbound connection limit (if error is outbound)
Dead Ends
Common approaches that don't work:
-
80% fail
This only affects outgoing HTTP connections; the error is about incoming connections to the App Service, not outbound.
-
90% fail
Restart resets connections temporarily but does not address the root cause; connections quickly rebuild and exceed the limit again.
-
70% fail
Disabling keep-alive may increase connection churn and worsen the issue, as each request opens a new connection.