无法加载文件或程序集“Oracle.DataAccess”或其依赖项之一。试图加载格式不正确的程序。缓存

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21424361/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 02:12:29  来源:igfitidea点击:

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. Ncache

c#visual-studio-2010oracledllncache

提问by Dhiraj Goplani

I have downloaded 64 bit Ncache application as i have 64 bit windows 7. I am creating a sample application using Ncache. The samples that come with Ncache runs perfectly fine. I am developing my own app using Ncache local cache. When i run that app throuhg Visual Studio 2010 i am getting the following error:

我已经下载了 64 位 Ncache 应用程序,因为我有 64 位 Windows 7。我正在使用 Ncache 创建一个示例应用程序。Ncache 附带的示例运行得非常好。我正在使用 Ncache 本地缓存开发我自己的应用程序。当我通过 Visual Studio 2010 运行该应用程序时,出现以下错误:

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.

无法加载文件或程序集“Oracle.DataAccess”或其依赖项之一。试图加载格式不正确的程序。

I installed latest version of oracle as well. The sample apps which Ncache provides are made in Visual Studio 2008 and i run them in Visual Studio 2010 after converting them. Oracle.DataAccess.dll that came with Ncache has version 2.112.1.0 and one that came with NCache has version 2.121.1.0. I am stuck on this for couple of days.

我也安装了最新版本的oracle。Ncache 提供的示例应用程序是在 Visual Studio 2008 中制作的,我在转换它们后在 Visual Studio 2010 中运行它们。Ncache 附带的 Oracle.DataAccess.dll 版本为 2.112.1.0,NCache 附带的一个版本为 2.121.1.0。我坚持了几天。

采纳答案by Dhiraj Goplani

The solution to this problem turned out to be very simple. Ncache.web internally uses Web dll. I removed the reference of the one which came with the Ncache and had to add a reference of Oracle.DataAccess.dll from 'assembly\GAC_64' as i was using .Net 4.0 and it was referencing 2.0 dll from 'C:\Windows\assembly' in case i don't add the reference of the one that comes with Ncache.

这个问题的解决方案非常简单。Ncache.web 内部使用 Web dll。我删除了 Ncache 附带的引用,并且必须从“assembly\GAC_64”中添加对 Oracle.DataAccess.dll 的引用,因为我使用的是 .Net 4.0,它引用了来自“C:\Windows\”的 2.0 dll程序集',以防我不添加 Ncache 附带的引用。