How to Fix Could not load file or assembly ‘System.Runtime, Version 6.0.0.0’ with .Net Core

In previous post, we have written few articles about the error that you can find when you deployed your Asp.net core. Error message like 500.30 – Asp.net Core failed to start or 502.3 – Bad Gateway in Asp.net Core. Here is other error message that you can find when you deployed Asp.net Core:

“Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly ‘System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)”

There are many things that you need to check although it is working fine on your localhost. Here is troubleshoot that you can try

1. Tried to get actual cause by checking dll from your Console option and you can see error like below:

2. Please make sure you modified the appsettings.production.json through App Service => App Service Editor option (at the time of this article this feature is on Preview), and as a result, you can see what is wrong with your CI/CD deployment.

3. Check and replace your appsetting.Production.json file locally by copying from the one that you deployed to your hosting provider and created by CI/CD process.

4. The offender was “,” an empty character, which was substituted for the keyvalut-related setting when CI/CD was generating the appSettings.Production.json. It should be fix your issue.

Conclusion

So if you ever encountered such errors with production, My first recommendation would be to run the application locally with the same configuration and appsettings.json or web.config used in deployment/production and save your time.

If you are looking for fast and secure ASP.NET hosting, you can visit our site at https://www.asphostportal.com. Our fully featured hosting already includes

  • Easy setup
  • 24/7/365 technical support
  • Top level speed and security
  • Super cache server performance to increase your website speed
  • Top 9 data centers across the world that you can choose.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *