【问题标题】:Invalid web.config causes HTTP 502.5 error无效的 web.config 导致 HTTP 502.5 错误
【发布时间】:2019-08-26 14:44:35
【问题描述】:

我正在尝试在 azure 上部署一个 Asp.net 样板应用程序,并且我已经部署了我的后端并且 Swagger 应用程序工作正常,当我尝试同时部署 Angular 前端时,我不断收到此错误:HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure

我找到了其他讨论这个问题的线程,但是由于我使用的是 ASP.NET Boilerplate 框架,所以我没有可以运行以启动 Web.Host 项目的.exe.dll 文件,不是那个我至少知道。

Kudu 中的日志显示:Application '/LM/W3SVC/288745522/ROOT' with physical root 'D:\home\site\wwwroot\' failed to start process with commandline '%LAUNCHER_PATH% %LAUNCHER_ARGS%'

这可能与那些未找到的 %LAUNCHER% 变量有关,我发现其他一些线程建议您应该替换 LAUNCHER_ROOT [projectname].exe[projectname].dll 但我似乎无法在我的项目中找到这些.这可能是因为 ASP.NET Boilerplate 的构建方式。

这是我的 web.config:

<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00">
      <environmentVariables />
    </aspNetCore>
    <httpProtocol>
      <customHeaders>
        <remove name="X-Powered-By" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>
</configuration>

【问题讨论】:

  • @LexLi 另一个线程中给出的答案不适用于我正在使用的 ASP.NET 样板框架,请检查我在第二段中的编辑
  • 它仍然是重复的,因为 502.5 的原因保持不变。如果不使用 ,请将其删除。

标签: asp.net angular azure .net-core azure-web-app-service


【解决方案1】:

错误消息表示 ASP.NET Core 模块尝试启动工作进程但无法启动。进程启动失败的原因通常可以从应用程序事件日志和 ASP.NET Core 模块标准输出日志中的条目中查看。两个日志都可以在 Kudu/SCM 站点的 d:\home\Logfiles 中找到。在位于 wwwroot 文件夹中的 web.config 文件中,启用标准输出日志,如下所示: Web.config 示例:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\MyApplicationAssembly.dll" stdoutLogEnabled="true" 
    stdoutLogFile="\\?\%home%\LogFiles\stdout" forwardWindowsAuthToken="false" />
  </system.webServer>
</configuration>

请检查您收集的 eventlog.xml 和 stdout 日志。

参考https://blogs.msdn.microsoft.com/waws/2018/06/10/troubleshooting-http-502-5-startup-issues-in-azure-appservice-for-asp-net-core-websites/

ASP.Net 的其他故障排除方法在

https://docs.microsoft.com/en-us/aspnet/core/test/troubleshoot-azure-iis?view=aspnetcore-2.2#troubleshoot-on-azure-app-service.

希望对你有帮助。

【讨论】:

  • 标准输出日志中的日志确实会生成,但是是空的,所以这些对我没有帮助。这是我在 eventlog.xml 中遇到的错误:Application '/LM/W3SVC/288745522/ROOT' with physical root 'D:\home\site\wwwroot\' failed to start process with commandline '%LAUNCHER_PATH% %LAUNCHER_ARGS%' with multiple retries. The last try of listening port is '10830'. See previous warnings for details.
猜你喜欢
  • 1970-01-01
  • 2017-02-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-08-09
相关资源
最近更新 更多