我想部署一個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.
感謝好友的見解! –