For me, the problem got resolved when I saw that under the advanced settings for the application pool which is getting the error, Enable 32-bit applications was set to TRUE.
This meant it only loaded 32-bit applications, and aspnetcore.dll is a 64-bit dll.