문제

I have .NET project which use CDO ActiveX. Everyhting works fine on Windows Server 2003 but when I move the project to Windows 2008 I get error below. Is this because CDO is not available on Windows 2008? How this could be solved?

Error: Could not load file or assembly 'Interop.CDO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format., 
StackTrace    at MailBotConsole.ServiceClass.ProcessEmail(String email)
도움이 되었습니까?

해결책

This System.BadImageFormatException occurs when a 64 bit assembly attempts to load a 32 bit assembly ( or vice versa ). I'd guess that your move from 2003 -> 2008 also involved a change in architecture. Make sure that your project matches the build target of the referenced assembly or try building as AnyCPU

다른 팁

I had the same issue when switching from a 32bit win xp environment to a windows 7 64 bit. I wanted to provide my solution for anyone else that had a similar issue, spent hours before I figured this out.

I had read that I needed to switch my Active Solution Platform to build in x86 mode, but this didn't fix the problem. Turns out I could leave my platform to any CPU and in my application pool under advanced settings ensure the .net framework was correct (in my case I had to switch it from 4.0 to 2.0) and I had to turn on "enable 32-bit applications" which was set to false.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top