简体   繁体   English

与Oracle的连接通过控制台应用程序工作,不能通过Web服务工作

[英]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. 您的控制台应用程序工作正常,因为它可能位于没有问题的文件夹中。

More info and a few solutions here . 更多信息和一些解决方案在这里

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.

相关问题 与Oracle的连接通过控制台应用程序运行,而无法通过Web应用程序运行-ORA-12154 - Connection to Oracle works through a console application and doesn't work through a web application - ORA-12154 Web响应无法通过GSM连接工作 - Webresponse doesn't work through GSM connection 控制台Web服务应用程序在编译时不起作用,但在Visual Studio中有效 - Console Web Service App Doesn't Work When Compiled, but works in Visual Studio ZeroMQ 在 Unity 中不起作用,但可以作为控制台应用程序使用 - ZeroMQ doesn't work in Unity, but works as console application 通过窗口服务调用控制台应用程序 - Calling a Console application through a Window Service 通过控制台应用程序使用Microsoft Web Deploy - Using Microsoft Web Deploy through Console Application UrlEncode通过控制台应用程序? - UrlEncode through a console application? 代码在控制台应用程序中有效,但在Windows Service中运行时不起作用 - Code works in a console application, but does not work when running in windows service 对服务的PATCH请求在我的C#应用​​程序中不起作用,但在Fiddler中起作用 - PATCH request to the service doesn't work within my C# application, but works in Fiddler 启用 https 时,应用程序设置中的连接字符串不起作用:Azure Web App - Connection string in application settings doesn't work when https is enabled: Azure Web App
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM