Could not load file or assembly ‘ChilkatDotNet2’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

Whilst setting up an application to run on my local machine (running Vista 64bit) I encountered this error:

Could not load file or assembly ‘ChilkatDotNet2’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

 

Obviously, the application uses ChilKat components, but it would seem that the version we are using, is only the 32bit version.

To resolve this error, I set my app pool in IIS to allow 32bit applications.
Open up IIS Manager, right click on the app pool, and select Advanced Settings (See below)

 

Set IIS AppPool Advanced Settings

Then set “Enable 32-bit Applications” to True.

Enable 32-Bit Applications

All done!

55 comments

  1. Useless. Switching that on will run the workerprocess(w3wp) also in 32-bit mode.

    How to make a 64-bit web app which refers to 32-bit DLLs inside the same app pool?

  2. Great I spent hours looking for possible problems in my code and then some more time searching for explainations on the net. Your solution worked 100% on Windows server 2008 64bit and Visual Studio 2010. Thanx

  3. Useless,I agree with J.This is not working in main [IIS] application is 64 BIt and it is trying to access 32Bit dll.

  4. Did not help me. There was no change. I restarted IIS also. Still get “an attempt was made .. incorrect format”. I changed both DefaultAppPool, and the app-pol for this specific site.

  5. if you are using in windows forms application
    go to project properties–>>Build tab and change platform target to x86,
    problem will be solved

    1. This works for me.
      Upgraded from win 2003 to win 2008 R2 64-bit. Got my XML Bulk loader 4.0 64 bit installed, but still received could not load assembly interop.sqlxmlbulkload until I changed the app pool to allow 32 bit applicaitons.

  6. ‘Oracle.DataAccess, Version=2.111.7.20, Culture=neutral, PublicKeyToken=89b483f429c47342’

    This error i got …

    my oracleClient 11g install on x86 ..

    But still get this problem ..?
    Any ideas frnd ?

  7. That solved my problem, but now I had an other problem “The requested page cannot be accessed because the related configuration data for the page is invalid.”

  8. Surrey if this is slightly off-topic, but I’m getting that same basic error on a non-asp.net (it doesn’t specify the name of the problem file, though); nevertheless, I’m wondering if changing “Enable32bit” to true has any potential downside (I *am* working on an asp.net app, too … will toggling false to true possibly cause a problem “down the road”?

  9. Thank you, it resolved following problem as well.

    Error message:
    Could not load file or assembly ‘Oracle.DataAccess’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

  10. Invaluable suggestions – my business several days ago used http://goo.gl/HShLoc. to access pdf – It’s phenominal efficient to apply and it’s excellent ! I saw they will give a 30 day promotion now

Comments are closed.