gpt4 book ai didi

asp.net-mvc - Aspnet Core Azure 失败并出现 HTTP 错误 502.5 - 进程失败

转载 作者:行者123 更新时间:2023-12-03 03:09:18 28 4
gpt4 key购买 nike

我正在尝试将 aspnet core 应用程序部署到 Azure。这似乎已经完成,但是当我尝试启动应用程序时,出现以下错误...

此问题的常见原因:

应用程序进程无法启动申请流程开始但随后停止应用程序进程启动但未能监听配置的端口

故障排除步骤:

检查系统事件日志中的错误消息启用记录应用程序进程的标准输出消息将调试器附加到应用程序进程并检查

这里似乎有很多关于 IIS 的文章,但没有关于 Azure 的文章,所以我不知道下一步该去哪里。 Azure 日志没有表明任何内容。

微软文档给了我这个信息...

Platform conflicts with RID

Browser: HTTP Error 502.5 - Process Failure

Application Log: - Application Error: Faulting module: KERNELBASE.dll Exception code: 0xe0434352 Faulting module path: C:\WINDOWS\system32\KERNELBASE.dll - IIS AspNetCore Module: Failed to start process with commandline '"dotnet" .\my_application.dll' (portable app) or '"PATH\my_application.exe"' (self-contained app), ErrorCode = '0x80004005'.

ASP.NET Core Module Log: Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'teststandalone.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.

Troubleshooting:

If you published a self-contained application, confirm that you didn't set a platform in buildOptions of project.json that conflicts with the publishing RID. For example, do not specify a platform of x86 and publish with an RID of win81-x64 (dotnet publish -c Release -r win81-x64). The project will publish without warning or error but fail with the above logged exceptions on the server.

...但告诉我这些设置对于 Azure 应该是什么(或者是否与那里相关)实际上并没有帮助,所以我不确定这是否是一个红鲱鱼。我没有在 dotnet 发布配置上指定 -r 开关。

我设法找到一个事件日志,它抛出了一些重复记录的 XML...

Failed to start process with commandline '"%LAUNCHER_PATH%" %LAUNCHER_ARGS%', ErrorCode = '0x80070002'.

经过更多调查,我发现我需要自己更改 %LAUNCHER_PATH% 和 %LAUNCHER_ARGS% 值。我尝试过对 web.config 进行各种更改,但没有成功。我的 web.config 现在看起来像这样...

<?xml version="1.0" encoding="utf-8"?>
<configuration>

<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->

<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="dotnet" arguments="site\wwwroot\Esoterix.Modle.Portalweb.dll" stdoutLogEnabled="true" stdoutLogFile="LogFiles\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>

这些路径来自Azure部署的根目录,它似乎适用于标准输出日志文件路径(我收到了报告的错误),但不适用于应用程序本身。我仍然看到以下错误..

<Event>
<System>
<Provider Name="IIS AspNetCore Module"/>
<EventID>1000</EventID>
<Level>0</Level>
<Task>0</Task>
<Keywords>Keywords</Keywords>
<TimeCreated SystemTime="2016-11-28T19:31:32Z"/>
<EventRecordID>1514022203</EventRecordID>
<Channel>Application</Channel>
<Computer>RD0004FFD7108D</Computer>
<Security/>
</System>
<EventData>
<Data>Failed to start process with commandline '"dotnet" site\wwwroot\Esoterix.Modle.Portalweb.dll', ErrorCode = '0x80004005'.</Data>
</EventData>
</Event>

重复4次

如果我查看我的标准输出输出,我会看到以下内容...

Failed to load the dll from [\?\D:\home\site\wwwroot\hostpolicy.dll], HRESULT: 0x800700C1

An error occurred while loading required library hostpolicy.dll from [\?\D:\home\site\wwwroot]

如果我尝试直接使用此处的 Web 配置运行 exe...

<?xml version="1.0" encoding="utf-8"?>
<configuration>

<!--
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
-->

<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="\\?\%home%\site\wwwroot\Esoterix.Modle.Portalweb.exe" arguments="" stdoutLogEnabled="true" stdoutLogFile="\\?\%home%\LogFiles\stdout" forwardWindowsAuthToken="false"/>
</system.webServer>
</configuration>

然后我的标准输出给了我以下错误...

Failed to load the dll from [\?\D:\home\site\wwwroot\hostfxr.dll], HRESULT: 0x80070057

The library hostfxr.dll was found, but loading it from \?\D:\home\site\wwwroot\hostfxr.dll failed

最佳答案

我通过添加对 dotnet-publish-iis 的引用解决了这个问题。

有关如何执行此操作的完整详细信息记录在 github 问题中 https://github.com/aspnet/Hosting/issues/892

关于asp.net-mvc - Aspnet Core Azure 失败并出现 HTTP 错误 502.5 - 进程失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40849138/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com