login about faq

In a web application, the following error shows up when browsing to a page that instantiates a Chilkat object. Could not load file or assembly 'ChilkatDotNet4' or one of its dependencies. An attempt was made to load a program with an incorrect format.

code behind : protected void Page_Load(object sender, EventArgs e) { Chilkat.Crypt2 c = new Chilkat.Crypt2(); }

Windows7 64bit / VS2010 v10.0.30319.1 / ASP.Net v4.0.30319.272

Thanks

asked Jun 20 '12 at 16:18

Matt's gravatar image

Matt
6112


It's a 32-bit vs. 64-bit mismatch. It means you are trying to load a 64-bit .NET assembly into a 32-bit process, or the reverse (a 32-bit assembly into a 64-bit process).

Here are possible solutions:

1) Target your app for x86 instead of "Any CPU". If you do this, then your application will run as a 32-bit process regardless of the machine architecture and you may always use the 32-bit Chilkat assembly.

2) If you really need to target "Any CPU", then make sure to deploy the 32-bit Chilkat assembly w/ your app on 32-bit systems, and deploy the 64-bit Chilkat assembly to 64-bit systems.

3) If your app is running within ASP.NET or a Windows Service and you're not quite sure whether it's 32-bit or 64-bit, then install the 32-bit Chilkat assembly in the 32-bit GAC (Global Assembly Cache), and also install the 64-bit Chilkat assembly into the 64-bit GAC. The .NET runtime will automatically look in the correct GAC and will find the correct assembly.

link

answered Jun 20 '12 at 16:23

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

I ended up creating separate IIS Application Pools, one for 32bit and a separate 64bit pool. Thanks for the education.

(Jun 20 '12 at 18:31) Matt

Also see this: http://stackoverflow.com/questions/266082/how-do-i-tell-if-my-application-is-running-as-a-32-bit-or-64-bit-application

First determine if your app is running 32-bit or 64-bit. If it's not as you thought, then this is the error. Otherwise, you're loading the wrong DLL at runtime.

(Jul 08 at 10:29) chilkat ♦♦

One more comment regarding Visual Studio and IIS: "Ah! So, by default, Visual studio (this is a new computer) is not configured to use 64 bit IIS Express. You have to set it by Tools > Options > Projects and Solutions > Web Projects. There is a checkbox to enable 64b it IIS. Crazy, uh? Thanks for your help!"

(Jul 08 at 10:30) chilkat ♦♦

Thanks for the suggestions.

Solved the problem 'my way': Opened the small sample project, just built to test the FTP functions of the downloaded Chilkat .Net dll.

Loaded all modules & forms from the full project into the test project. Changed the startup object, adjusted some of the libraries & everything runs just fine.

Only project renaming & deleting of the test module still needs to be done.

Have no idea why I got that error in the main project & will most likely never know.

Thanks again, Peter K

link

answered Jun 28 '12 at 16:57

Peter%20123's gravatar image

Peter 123
1111

+1 for enable 64b IIS Express, this is what I have been looking for.

Tools > Options > Projects and Solutions > Web Projects. There is a checkbox to enable 64b it IIS

link

answered Aug 17 at 11:06

jonranes's gravatar image

jonranes
11

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×18
×13
×2

Asked: Jun 20 '12 at 16:18

Seen: 46,438 times

Last updated: Aug 17 at 11:06

powered by OSQA