OracleException (0x80004005) When Connecting to Or

2020-03-25 12:50发布

问题:

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:

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

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.

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.

回答1:

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.

This answer has several options which might help.