asp.net - 无效的 web.config 导致 HTTP 502.5 错误
问题描述
我正在尝试在 azure 上部署一个 Asp.net 样板应用程序,并且我已经部署了我的后端并且 Swagger 应用程序工作正常,当我尝试也部署 Angular 前端时,我不断收到此错误:HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure
.
我找到了其他讨论这个问题的线程,但是由于我使用的是 ASP.NET 样板框架,所以我没有可以运行的文件.exe
或.dll
文件来启动 Web.Host 项目,至少我不知道。
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
or[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>
解决方案
错误消息表示 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 和标准输出日志。
ASP.Net 的其他故障排除方法,位于
希望能帮助到你。
推荐阅读
- react-native - 不变违规:requirenativecomponent:在uimanager中找不到“rncamera”
- java - 如何迭代具有数组列表的数组?
- reactjs - 仅当状态为 true 时才应用 fetch 回调
- c# - MVC、Angular 8 和 signalR 随机行为,有时无法连接到集线器,如何解决?
- ruby-on-rails - 如何让 Rails 识别我添加到 usr/bin 的 sqlite3 版本?
- azure - 如何将拒绝分配置于 Azure 订阅或资源组级别?
- delphi - Delphi Rio 10.3.2 - 无法注册简单的 32 位 ActiveX 服务器
- javascript - 悬停效果等待ajax调用
- r - 是否可以删除 R 中重复的句子/文本块?
- javascript - 将 v-edit-dialog 与组件一起使用?