Aspnet核心Azure失败,HTTP错误502.5 - 进程失败
我想部署一个aspnet核心应用到Azure。这似乎通过OK去了,但是当我尝试启动,我看到下面的错误应用...Aspnet核心Azure失败,HTTP错误502.5 - 进程失败
这个问题的常见原因:
应用程序未能启动 申请程序开始,但随后停止 应用程序启动,但没有听配置的端口上
故障排除步骤:
检查系统事件日志中的错误消息 启用日志记录的应用程序标准输出消息 一个调试器附加到应用程序,并检查
似乎有很多写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.
...但实际上并没有告诉我帮助这些设置应该是什么天青(或者如果它是相关的有),所以我”我不确定这是不是红鲱鱼。我没有在我的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的部署的根,这似乎对于stdout日志文件路径的工作(我正与报告的错误),但不应用程序本身。我仍然看到下面的错误..
<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
Installing .NET Core prerequisites might help resolve this problem.
我通过添加对dotnet-publish-iis的引用来解决此问题。
如何做到这一点的全部细节会被记录在GitHub的问题在https://github.com/aspnet/Hosting/issues/892
感谢好友的见解! –