HTTP Error 500.31 - ANCM Failed to Find Native Dependencies
I recently updated my blog to move from a custom code base to the wonderful PiranhaCMS. Upon publishing the site to my Azure AppService I received the following 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
For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028526
This error occurs when the site can't find the correct .NET Core runtime to use. I checked in the Azure Portal and I was setup to use .NET 6 which matched the target of my project. Upon further inspection I realized that when I published (into an existing AppService) it had left many of the old files out there and and something those files were the culprit causing the issue.
I was able to resolve the error by having my publish profile delete all existing files before publishing.