System.BadImageFormatException: Index not found. (Exception from HRESULT: 0x80131124)

If you get a

An unhandled exception has occurred while executing the request. 
System.BadImageFormatException: Index not found. (Exception from HRESULT: 0x80131124)

error when publishing your website through Visual Studio, a couple of things to check are:

  • When publishing the application to Azure make sure that the “Remove Additional Files at destination” option is checked.

    image
  • Made sure that all the projects(only one) were being build as “Any CPU” in both “debug” and “release” configuration.
    image

You may also like

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.