[英]Connection to Oracle works through a console application and doesn't work through a web service
I can't connect to an Oracle schema through a asmx web service instead of I can through a console application [x86]. 我无法通过asmx Web服务连接到Oracle模式,而不是通过控制台应用程序[x86]。
The code: 代码:
var conn = new OracleConnection("Data Source=xe;User ID=mySchema;Password=myPass");
The exception: 例外:
ORA-12154: TNS:could not resolve the connect identifier specified
The environment: Windows 7 x64 - VS 2008. 环境:Windows 7 x64 - VS 2008。
Any idea? 任何的想法?
kindly ask me for any extra information 请您提供任何额外信息
Thanks in advance. 提前致谢。
OCI, the Oracle client layer on which ODP (or the native Oracle client layer) is based has a bug that prevents any application located in a folder containing parentheses () from running properly OCI(ODP(或本机Oracle客户端层)所基于的Oracle客户端层有一个错误,可防止位于包含括号()的文件夹中的任何应用程序正常运行
This bug is very visible since the apparition of the Program Files (x86) folder... 自Program Files(x86)文件夹显示以来,此错误非常明显...
The host running your application (typically IIS) is probably located in the x86 folder, hence the issue. 运行应用程序的主机(通常是IIS)可能位于x86文件夹中,因此存在问题。 Your console app works fine because it's probably located in a folder that does not have the issue.
您的控制台应用程序工作正常,因为它可能位于没有问题的文件夹中。
I'm not an Oracle guy in any way but I've run into similar situations in other databases. 我不是任何方式的甲骨文家伙,但我在其他数据库中遇到过类似的情况。 The problem we had was that the DSN was created as a User DSN and not a System DSN.
我们遇到的问题是DSN是作为用户DSN创建的,而不是系统DSN。 I don't know how Oracle data sources are created but I would check this out.
我不知道如何创建Oracle数据源,但我会检查一下。
I got the exact same issue. 我得到了完全相同的问题。 I resolved by referencing
Oracle.ManagedDataAccess.dll
instead of Oracle.DataAccess.dll
. 我通过引用
Oracle.ManagedDataAccess.dll
而不是Oracle.DataAccess.dll
来解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.