Deploying a web-based application with Informix database to server

0

Background

A C#/.NET web application that accesses an Informix database. The Client SDK is installed locally.
Project references the IBM.Data.Informix.dll in the IBM SDK directory I'm using the older dll because the Informix database we have to access is ancient (Version 7.something)

It works perfectly on my machine (Windows 10) when running in debug mode through Visual Studio. Great, I'll deploy it to the Test server (Windows Server 2012 R2).

First attempt

  • Straightforward file deployment from Visual Studio
  • Run the app to access the database
  • Error
Could not load file or assembly 'IBM.Data.Informix, Version=3.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208' or one of its dependencies. 
The system cannot find the file specified.

Second attempt

  • Copied dll to a project folder named lib
  • Changed project reference to this dll
  • Deployed
  • Same error as first attempt

OK, I'd better research this. See below for references.

Third attempt

  • Removed reference to sdk dll
  • Installed from NuGet - the Avatar Solucoes version
  • Deployed
  • Same error as first attempt

More research

Fourth attempt

  • Copied gacutil files to server and installed dll from third attempt into GAC
  • Deployed
  • New error
The type initializer for 'IBM.Data.Informix.IfxConnection' threw an exception.
Unable to load DLL 'iclit09b.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) 

More research

Fifth attempt

  • Uninstalled NuGet package
  • Referenced dll from sdk
  • Added sdk .dll to gac on server
  • Refreshed app
  • Same error as first attempt

More research

Sixth attempt

  • Installed from NuGet - the Avatar Solucoes version again
  • added same dll to gac on server
  • created new folder C:\informix on server
  • copied iclit09b.dll from ibm sdk to this folder
  • added folder to PATH
  • Restarted IIS
  • Deployed
  • Error same as fourth attempt

More research

Seventh attempt

  • Copied iclit09b.dll to the deployed bin folder.
  • Deployed
  • Error same as fourth attempt

More research

Found this ominous paragraph https://www.ibm.com/developerworks/data/library/techarticle/dm-0510durity/index.html

Important: The IBM Informix ADO.Net driver is not self-contained in the IBM.Data.Informix.dll file that gets installed in the /bin directory of your installation. Apparently, it uses some of the other client code installed by the SDK. This means that you must install the Informix Client SDK on any machines that will use the ADO.Net driver. You cannot just include the IBM.Data.Informix.dll in your distribution. This could be a serious limitation for some applications. You also need to go through the SDK setup (SetNet32) to define your Informix data sources.

Do we really need to install the SDK on production servers? And have to install DLLs in the GAC? If so, how can people deploy to servers over which they have no control?

As you can probably tell, I don't have much experience with Informix and .NET.

I literally have no idea what to do next.

Any suggestions will be most gratefully received.

References in no particular order

Update 2019-01-25

Following on from @Satyan's answer I uninstalled all previous versions of the SDK and cleared the GAC

Eighth attempt

  • I installed the latest SDK
  • I referenced the net40 version of IBM.Data.Informix.dll
  • I added this version to the GAC
  • On my local machine I got the same error as the first attempt

Ninth attempt

  • I referenced the net20 version of IBM.Data.Informix.dll
  • I added this version to the GAC
  • On my local machine I got the same error as the first attempt

Tenth attempt

Fortunately I still had a copy of the older IBM.Data.Informix.dll

  • I referenced the older version of IBM.Data.Informix.dll
  • I added this version to the GAC
  • On my local machine I can run the program successfully again. Phew!
  • I deployed to the server
  • Get the same error as the fourth attempt

More research

Found these articles

which suggest the resolution is

Set INFORMIXDIR and PATH as system environment variables and then bounce the Microsoft Internet Information Server or the whole machine and try to run your ASP application again.

Eleventh attempt

  • Added new INFORMIXDIR system environment variable
  • Restarted IIS
  • Try the application
  • Nope. Still get the same error as the fourth attempt.

In my research I have found reference to 'Informix Connect' which is supposedly used to install client products and in the client_install.pdf in the SDK download it makes reference to installconnect.exe, but that exe does not exist in the SDK I downloaded. If it is a separate download to the SDK, then I can't find it.

Update 2019-02-08

Decided to have another crack at this

Twelfth attempt

  • Added informix directory nearer to start of environment path
  • Restarted IIS
  • New error
SQL0035N The file "en_us\IBM.Data.Informix.xml" cannot be opened. 
at IBM.Data.Utilities.IfxResource..ctor(CultureInfo cultureInfo, String dirName, String fileName, String szMsgPath, String xpath)
   at IBM.Data.Utilities.IfxResources.GetResource(CultureInfo cultureInfo, String xpath)
   at IBM.Data.Informix.IfxException.get_Message()

Aha! A new error, I'm getting somewhere.

Thirteenth attempt

  • Copied C:\Program Files\Informix Client-SDK 4.10.FC9\msg folder to INFORMIX folder on the server
  • Added IIS_IUSRS to informix folder
  • Restarted IIS
  • Same error as twelfth attempt

I also tried copying just the en_us folder into the informix folder - nope!

More references

Update 2019-02-14

Fourteenth attempt OK. I decided to risk it and install the SDK on the server.

What I didn't expect was the installation restarting the server without asking me first.

Anyway, when it came back up we were back to the original error

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

OK. That didn't work. It also somehow messed up the installation of TFS which could no longer be accessed via a browser.

OK, I'll uninstall the SDK. Nope. The uninstall feature crashed out with a Java stack overflow error. Fortunately the server is a virtual, so I got last night's backup restored. All OK again.

.net
informix
asked on Stack Overflow Jan 24, 2019 by Mark_Gibson • edited Feb 14, 2019 by Mark_Gibson

2 Answers

1

The latest .Net driver which is V4, has equally good backward compatibility, and it is expected to work good with Informix database server version7. I would encourage you to try the latest.

The problem you may be getting is due to a clash with the old driver binary still deployed in the GAC (Global Assembly Cache). If so, worth try cleanup the GAC, and it can be done by the following command. Open Visual Studio Command Window (that matched the .net framework version you are using, in this case we are using .net SDK v4) FYI: Deploying assembly to the GAC may required Admin privilege, then you may open the VS command window as administrator.

cd INFORMIXDIR\bin\netf40
gacutil /u IBM.Data.Informix

Once the old binary is being cleared from GAC, reinstall it to the GAC by the following command.

gacutil /i IBM.Data.Informix.dll
answered on Stack Overflow Jan 24, 2019 by Satyan
0

Just for the record here's how I managed to solve the problem

  • Created a virtual machine with nothing else installed (apart from IIS)
  • Installed the Informix SDK on this new VM
  • Wrote an API for accessing the Informix database
  • Published the API to the new VM
  • Wrote another application that accesses the API
  • Deployed the new app to the correct server

It works, but I would have preferred a self-contained application instead of having to maintain two solutions.

answered on Stack Overflow Jun 17, 2019 by Mark_Gibson

User contributions licensed under CC BY-SA 3.0