连接到 Oracle 数据库时出现 OracleException (0x80004005)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20646800/
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:08:16  来源:igfitidea点击:

OracleException (0x80004005) When Connecting to Oracle Database

c#asp.netoracleiis

提问by Liam M

I've developed a simple C#, .net 4.0 website which I'd like to deploy onto an IIS test server. I am using the Oracle.DataAccess assembly to connect to an Oracle database, and I've added that DLL (and a hell of a lot of other related DLL's, just for good measure and in a shotfun attempt to try and solve this problem), to the bin folder of my website. it works fine on my development machine (obviously; worked fine before copying all of those DLLs), but not my test server. On the test server I receive the following exception:

我开发了一个简单的 C#、.net 4.0 网站,我想将其部署到 IIS 测试服务器上。我正在使用 Oracle.DataAccess 程序集连接到 Oracle 数据库,并且我已经添加了该 DLL(以及许多其他相关的 DLL,只是为了很好的衡量和尝试解决这个问题的有趣尝试) , 到我网站的 bin 文件夹。它在我的开发机器上运行良好(显然;在复制所有这些 DLL 之前运行良好),但不是我的测试服务器。在测试服务器上,我收到以下异常:

[OracleException (0x80004005)]
   Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck) +1468
   Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src) +24
   Oracle.DataAccess.Client.OracleConnection.Open() +4391
   MappingQueries.connect() +173
   scripts_list_mappings.Page_Load(Object sender, EventArgs e) +17
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
   System.Web.UI.Control.OnLoad(EventArgs e) +91
   System.Web.UI.Control.LoadRecursive() +74
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

No error message, no specifics. Is there some way I can get more information, or could there be some solution to this problem? I'm at a bit of a loose end here, so any useful information would be greatly appreciated.

没有错误信息,没有细节。有什么方法可以获得更多信息,或者可以解决这个问题吗?我在这里有点松散,所以任何有用的信息将不胜感激。

The Solution (sort of)

解决方案(有点)

Okay, I've fixed this in a roundabout way, and I'd like to leave a few suggestions for whoever comes up against a similar problem.

好的,我已经以迂回的方式解决了这个问题,我想给遇到类似问题的人留下一些建议。

First things first: it helped me to have a simple test application which I could use to determine if the problem was IIS. I used a simple C# application that connected to my Oracle database. My aim was to get that to work properly, which I did so by installing the Oracle instant client.

第一件事:它帮助我拥有一个简单的测试应用程序,我可以用它来确定问题是否出在 IIS 上。我使用了一个连接到我的 Oracle 数据库的简单 C# 应用程序。我的目标是让它正常工作,我通过安装 Oracle 即时客户端来做到这一点。

Next step: run the application using a privileged account. I used my own administrative account, which I had run my test application with.

下一步:使用特权帐户运行应用程序。我使用了我自己的管理帐户,我用它运行了我的测试应用程序。

Finally, to determine whether this was a 32/64 bit problem, I checked the registry to determine where my Oracle variables were: HKLM/Software/Oracle, or HKLM/Software/WOW6432/Oracle. I also tried running SQLPLUS from the command line, and checking weather the process displayed as *32 (to indicate a 32 bit application), in the Process Manager.

最后,为了确定这是否是 32/64 位问题,我检查了注册表以确定我的 Oracle 变量在哪里:HKLM/Software/Oracle 或 HKLM/Software/WOW6432/Oracle。我还尝试从命令行运行 SQLPLUS,并检查进程管理器中显示为 *32(表示 32 位应用程序)的进程的天气。

I think that's about it. Clearly there's no 'one size fits all, solution to this problem, but hopefully anyone who comes across this question will find some assistance in the details I've provided, and the helpful comments below.

我想就是这样。显然,没有“一刀切”解决这个问题,但希望遇到这个问题的任何人都能在我提供的细节中找到一些帮助,以及下面的有用评论。

回答by Dillie-O

While you did not get a specific error message, there's a good chance that there is an incompatibility with ODP.Net (version numbers, 32bit vs 64bit DLLs) installed locally vs. on your test server.

虽然您没有收到特定的错误消息,但很有可能与本地安装的 ODP.Net(版本号,32 位与 64 位 DLL)与测试服务器上的不兼容。

This answerhas several options which might help.

这个答案有几个可能有帮助的选项。