Could not load file or assembly 'IBM.Data.Informix' or one of its dependencies.

Accessing IBM informix from ASP.NET MVC Web Application


- Open Visual Studio


- In Solution Explorer, right-click on the References node and choose Add Reference


- Select the Add Reference option


- Click Browse


- Add the IBM.Data.Informix library


ibm-data-informix.PNG

We have two different versions of IBM.Data.Informix library:


ibm-data-informix_1.PNG

ibm-data-informix_2.PNG

First, we are choosing the version 4.00.01000.2 from the versions of the library


ibm-data-informix_3.PNG

Start the project by pressing F5


We don't get any errors on localhost. But after publishing our project, we get the "Could not load file or assembly 'IBM.Data.Informix' or one of its dependencies. An attempt was made to load a program with an incorrect format." error:


ibm-data-informix_4.PNG

To solve this error, Select the IBM.Data.Informix DLL under the list of References and open properties. Set the "Copy Local" property to "False".


ibm-data-informix_5.PNG

We publish our project again.


After publishing our project, we get the "Could not load file or assembly 'IBM.Data.Informix, Version=4.0.0.2, Culture=neutral, PublicKeyToken=' or one of its dependencies. The system cannot find the file specified." error:


ibm-data-informix_6.PNG

Could not load file or assembly 'IBM.Data.Informix, Version=4.0.0.2, Culture=neutral, PublicKeyToken=' or one of its dependencies. The system cannot find the file specified


The system doesn't find the IBM.Data.Informix DLL. We manually add the library to the bin folder under the directory we published.


ibm-data-informix_7.PNG

We refresh our web page to see the change


ibm-data-informix_8.PNG

We get our first error again.


Using the CSDK 4.10xC6 64bit version of the IBM.Data.Informix library, we will follow the above instructions again.


ibm-data-informix_9.PNG

We refresh our web page to see the change


Informix connection has been successfully established