无法加载文件或程序集 CDO
我有使用 CDO ActiveX 的 .NET 项目。 Everything 在 Windows Server 2003 上运行良好,但当我将项目移至 Windows 2008 时,出现以下错误。这是因为 CDO 在 Windows 2008 上不可用吗?这该如何解决呢?
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)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当 64 位程序集尝试加载 32 位程序集(反之亦然)时,会发生此 System.BadImageFormatException。我猜你是从 2003 年开始搬迁的 -> 2008 年还涉及架构的变化。确保您的项目与引用程序集的构建目标匹配,或尝试构建为 AnyCPU
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从 32 位 win xp 环境切换到 Windows 7 64 位时,我遇到了同样的问题。我想为其他有类似问题的人提供我的解决方案,我花了几个小时才解决这个问题。
我读过,我需要将我的 Active Solution Platform 切换为以 x86 模式构建,但这并不能解决问题。事实证明,我可以将我的平台留给任何 CPU,并在高级设置下的应用程序池中确保 .net 框架正确(在我的情况下,我必须将其从 4.0 切换到 2.0),并且我必须打开“启用 32 位”应用程序”被设置为 false。
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.