I have migrated my project to asp.net core 3.1 but when I deploy to azure web app its failing to start.
Displaying an error
HTTP Error 500.31 - ANCM Failed to Find Native Dependencies Common solutions to this issue: The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found. Troubleshooting steps: Check the system event log for error messages Enable logging the application process' stdout messages Attach a debugger to the application process and inspect
<EventData>
<Data>Could not find 'aspnetcorev2_inprocess.dll'. Exception message:
Invalid runtimeconfig.json [D:\home\site\wwwroot\Flymark.Online.Web.runtimeconfig.json] [D:\home\site\wwwroot\Flymark.Online.Web.runtimeconfig.dev.json]
</Data>
<Data>Process Id: 23260.</Data>
<Data>File Version: 13.1.20074.3. Description: IIS ASP.NET Core Module V2. Commit: e81033e094d4663ffd227bb4aed30b76b0631e6d</Data>
</EventData>
OR
<EventData>
<Data>Could not find 'aspnetcorev2_inprocess.dll'. Exception message:
Failed to load the dll from [D:\home\site\wwwroot\hostpolicy.dll], HRESULT: 0x8007007E
An error occurred while loading required library hostpolicy.dll from [D:\home\site\wwwroot\]
</Data>
<Data>Process Id: 21176.</Data>
<Data>File Version: 13.1.20074.3. Description: IIS ASP.NET Core Module V2. Commit: e81033e094d4663ffd227bb4aed30b76b0631e6d</Data>
</EventData>
I am building my app in azure dev ops using build.yml
steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '3.1.x'
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: restore
projects: '**/*.csproj'
vstsFeed: 'a8d40e20-5070-473a-8928-33122e7035b7'
- script: dotnet tool install --global dotnet-ef
displayName: 'dotnet install ef'
workingDirectory: Source
- script: dotnet publish -c Release -r win-x64 --self-contained
displayName: 'dotnet publish web'
workingDirectory: Source/Web
- script: dotnet ef migrations script --idempotent --project Online.Db --startup-project web -o $(Build.ArtifactStagingDirectory)/Online.Db.sql
displayName: 'Prepare sql scripts'
workingDirectory: Source
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: 'Source/Web/bin/Release/netcoreapp3.1/win-x64/publish'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)/Web.zip'
replaceExistingArchive: false
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: Release'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: Release
condition: succeededOrFailed()
On azure dotnet --info returns
.NET Core SDK (reflecting any global.json):
Version: 3.1.103
Commit: 6f74c4a1dd
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x86
Base Path: D:\Program Files (x86)\dotnet\sdk\3.1.103\
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
1.1.14 [D:\Program Files (x86)\dotnet\sdk]
2.1.513 [D:\Program Files (x86)\dotnet\sdk]
2.2.109 [D:\Program Files (x86)\dotnet\sdk]
3.1.103 [D:\Program Files (x86)\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.14 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.17 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.14 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.17 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.1 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.3 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.16 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.13 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.17 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.3 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
I thought issue is with bitness as dotnet info return win10-x86 but when I created new core app and deployed from visual studio it works well.
Its crazy.. After spending a week, issue turn out to be stdoutLogFile=".\logs\stdout"
after I made web.config transformation and changed it to stdoutLogFile="\\?\%home%\LogFiles\stdout"
now it works
So ANCM errors in Azure never seem to actually correspond to the ANCM message. For example if it complains about missing dependencies, it's probably because an unhandled exception is being thrown in Startup.cs. Yep.
Fastest way to see the "true" error is to try to run the app from Kudu (Azure app -> Development Tools section -> Advanced Tools -> "Go", use the in-browser terminal to run MyApp.exe
by simply typing in its path and hitting enter). When the ANCM error is resolved, you'll get "app started on localhost:5000" or something like that. Otherwise it will show a stack trace that tells you exactly what the problem is.
User contributions licensed under CC BY-SA 3.0