The type initializer for 'Sybase.Data.AseClient.AseConnection' threw an exception


I created ASP.Net web application in Visual Studio 2013. This application uses Sybase.Data.AseClient.dll to connect to Sybase database.

When I press F5 and debug application then it runs fine. No issues. But when I publish it using VS in C:\inetpub\wwwroot folder then I get following error when trying to browse the website:

The type initializer for 'Sybase.Data.AseClient.AseConnection' threw an exception.

How do I fix this issue?


Inner exception being thrown is shown below.

System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at Sybase.Data.AseClient.Unmanaged.AseGetDriverVersion(StringBuilder value, Int32 capacity) at Sybase.Data.AseClient.AseConnection.CheckVersion()
asked on Stack Overflow Jun 11, 2015 by Frank Martin • edited Jun 11, 2015 by Frank Martin

1 Answer

  1. On IIS, select aplications pools on left panel
  2. Select the aplication pool used on the website on the center panel
  3. Click on advanced Settings on the rigth panel
  4. On "Enable 32-Bit Applications" set the value to true
  5. stop and start the aplication pool
answered on Stack Overflow Jul 17, 2018 by user3247097

User contributions licensed under CC BY-SA 3.0