HTTP Error 500.31 – ANCM Failed to Find Native Dependencies in IIS

I have received the same error after upgrading my ASP.NET Core project from .NET Core 3.0 to 3.1 and installing Microsoft .NET Core 3.1.0 – Windows Server Hosting.

Quick (but bad) fix

changed the web.config handler from AspNetCoreModuleV2 to AspNetCoreModule and it worked ok.

Good fix

Find the underlying cause by inspecting Event Viewer. There might be multiple causes for this error, but in my case it was not finding an assembly related to CodeAnalysis

Unable to locate application dependencies. Ensure that the versions of
Microsoft.NetCore.App and Microsoft.AspNetCore.App targeted by the
application are installed.

Could not find ‘aspnetcorev2_inprocess.dll’. Exception message: Error:
An assembly specified in the application dependencies manifest
(myproject.deps.json) was not found: package:
‘Microsoft.CodeAnalysis.CSharp.Workspaces’, version: ‘3.3.1’ path:
‘lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.Workspaces.dll’

Although they are related these messages were in different events.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)