502.5 cloud runtime_error ai_generated true

HTTP 错误 502.5 - ANCM 进程外启动失败

HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure

ID: cloud/azure-app-service-http-502-bad-gateway

其他格式: JSON · Markdown 中文 · English
80%修复率
85%置信度
1证据数
2023-06-20首次发现

版本兼容性

版本状态引入弃用备注
Azure App Service Windows active
.NET 6 active
.NET 8 active
ASP.NET Core Module 18.0 active

根因分析

托管在 Azure 应用服务上的 ASP.NET Core 应用程序因缺少运行时依赖项、启动命令不正确或应用程序与 IIS ANCM 模块之间的端口不匹配而无法启动。

English

ASP.NET Core application hosted on Azure App Service fails to start due to missing runtime dependencies, incorrect startup command, or port mismatch between the application and the IIS ANCM module.

generic

官方文档

https://learn.microsoft.com/en-us/troubleshoot/azure/app-service/web-apps-open-source-technologies-faqs#http-error-5025---ancm-out-of-process-startup-failure

解决方案

  1. Enable detailed error logging via `appsettings.json`: set `"ASPNETCORE_DETAILEDERRORS": "true"` and `"ASPNETCORE_ENVIRONMENT": "Development"` in the App Settings blade; then redeploy and check the stdout log at `D:\home\LogFiles\stdout\`. Fix any missing NuGet packages or framework versions.
  2. Ensure the application listens on the correct port by adding `UseUrls` in `Program.cs` or setting the `PORT` environment variable to `8080` (the default port ANCM expects). Example: `webBuilder.UseUrls("http://*:8080");` in `CreateHostBuilder`.

无效尝试

常见但无效的做法:

  1. 90% 失败

    The application binary or its dependencies are still broken; restarting only re-executes the same failing startup sequence.

  2. 65% 失败

    The stdout log may show generic messages; the actual error (e.g., 'Could not load file or assembly') is often written to stderr or the Windows Event Log.