32-bit dll not loading with Enable32Mode in IIS 7.5

I have an MVC 3 website linking to a 32 bit DLL. OS - Windows 2008 R2 x64. The website is in the ASP.NET 4 application pool. I have enabled Enable32Bit, but it does not work. I get a Bad Image Exception, but I can't figure out how to enable this login level in IIS. I installed a page that displays whether it works on 32 bits or 64 bits, and when I turn Enable32Bit on / off in AppPool, I get the correct output. The website is also in full confidence.

I can’t try and get it to work. I know that it works on Win7 32bit.

Can you suggest some things to try?

UPDATE: I just wrote a simple Windows Forms application with a button on it that calls my DLL. This was built with the goal of x86, and it worked fine, so I think the problem is with IIS or ASP.Net. Here is the code used to reference the DLL:

        [DllImport("CDCrypt.dll")]
        [return: MarshalAs(UnmanagedType.LPStr)]
        public static extern String Encrypt([MarshalAs(UnmanagedType.LPStr)] String aName);



        [DllImport("CDCrypt.dll")]
        [return: MarshalAs(UnmanagedType.LPStr)]
        public static extern String Decrypt([MarshalAs(UnmanagedType.LPStr)] String aName);

UPDATE 2: Does it matter if the ASP.Net pipeline is Clasic or Integrated? I tried the same problem but thought it was worth asking

UPDATE 3: I found this question trying to do the same and it gave up, which is not very useful !!

+3
source share
2 answers

Ensure that all managed assemblies focus on x86instead of Any CPUor x64in project properties.

+1

dll 64 , CPU. 32- , 32- , . , 64- . iis. , .

0

All Articles