FileLoadException: Could not load file or assembly ‘Microsoft.AspNetCore.Mvc.Core, Version=2.1.3.0’

Today I got an alert that somehow my Azure Traffic Manager endpoint stopped working with returning a 500. That means that both regions I set up behind the traffic manager were down. So I checked both endpoints and both came back with the same issue, the web app couldn’t start up at all. So that was interesting since there were no deployment or any other changes I did.

I enabled the developer error page to get the exact error and I didn’t expect to get this error:

FileLoadException: Could not load file or assembly 'Microsoft.AspNetCore.Mvc.Core, Version=2.1.3.0'

For some reason it could not find that assembly???

So I went to check the project and references, tried it locally and it ran totally fine. Googled a bit and found this:

https://github.com/Azure/app-service-announcements-discussions/issues/65

https://github.com/aspnet/AspNetCore/issues/3503

Apparently many have the same issue and it appears that somehow it was related with updates internally to Azure and the AspNet.Core version they are using. Its a bit annoying since it happened over night and were not changes I did, but here is the fix:

If you have this in your web app project file:

<PackageReference Include="Microsoft.AspNetCore.App" />

Change it to:

<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.3" />

Annoying but works….

Leave a Reply

Your email address will not be published.