core 3.1 - InProcess on Azure app Service HTTP Error 500.31 - ANCM Failed to Find Native Dependencies


I have migrated my project to 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

            <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\]
            <Data>Process Id: 23260.</Data>
            <Data>File Version: 13.1.20074.3. Description: IIS ASP.NET Core Module V2. Commit: e81033e094d4663ffd227bb4aed30b76b0631e6d</Data>


            <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>Process Id: 21176.</Data>
            <Data>File Version: 13.1.20074.3. Description: IIS ASP.NET Core Module V2. Commit: e81033e094d4663ffd227bb4aed30b76b0631e6d</Data>

I am building my app in azure dev ops using build.yml

  - task: UseDotNet@2
      packageType: 'sdk'
      version: '3.1.x'

  - task: DotNetCoreCLI@2
    displayName: Restore
      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
      rootFolderOrFile: 'Source/Web/bin/Release/netcoreapp3.1/win-x64/publish' 
      includeRootFolder: false 
      archiveType: 'zip'
      archiveFile: '$(Build.ArtifactStagingDirectory)/' 
      replaceExistingArchive: false 

  - task: PublishBuildArtifacts@1
    displayName: 'Publish Artifact: Release'
      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:

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.


1 Answer


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

answered on Stack Overflow Apr 29, 2020 by Volodymyr Bilyachat

User contributions licensed under CC BY-SA 3.0