Categories
English Uncategorized

How to fix the error “Attempt to load Oracle client libraries threw BadImageFormatException” in IIS Express

First I did the following:

  • Add Oracle DSN in: ODBC sources (you can find it in start >> search >> odbc data sources) then go to user DSN and add oracle, you can test the connection there. However this didn’t fix the problem, maybe it contributed in the solution.
  • Try different oracle provider (like Oracle.DataAccess). This didn’t work.
  • Change the server name in the connection string, trying to add or remove the port, or adding @username. This also didn’t work.
  • Change the solution CPU to 64 or 86. This also didn’t work as long as the IIS is running under specific CPU that’s different than the one in your solution.

The following steps have worked with me fine:

  • Going to: Tools >> Options >> Projects and solutions >> Web projects >> Check “Use the 64 bit version of IIS Express for web sites and solutions”.
  • Then change the processor of the project from: Debug >> ProjectName Properties >> Build >> Platform target >> set to 64.
  • And maybe the DSN step was also contributing in this solutions.

Leave a Reply

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