IIS站点未连接到Oracle数据库(IIS site not connecting to Oracle database)

编程入门 行业动态 更新时间:2024-10-28 22:25:15
IIS站点未连接到Oracle数据库(IIS site not connecting to Oracle database)

我有一个IIS服务器托管网站。 其中一些网站(Silverlight)必须连接到Oracle数据库以通过OleDb执行查询,但它们不能。

以下是我测试的结果:

当我在网站上运行时, 'msdaora'提供者没有在本地机器上注册

ORA-01019:无法在用户端分配内存 (当我尝试连接没有管理员状态的测试控制台程序时)

连接正常 (使用与管理员状态相同的测试控制台程序)

ORA-12154:TNS:无法解析尝试切换到另一种连接方法时指定的连接标识符 (从OleDb到Oracle.ManagedDataAccess.Client)

我经历了无数关于这些错误的信息,但我找不到任何工作解决方案。 这是我测试的内容:

为相关用户提供“创建全球对象”的权利(根本不变) 一个接一个地安装几个Oracle客户端。 最好的结果是10.2客户端64b(我的测试程序可以在具有管理员权限的情况下连接)。 安装是干净的(同时没有几个Oracle文件夹或几个Oracle环境变量)

禁用有关管理员提升的警告(即在提升期间不弹出确认):完全没有改变

检查RAM的使用情况(脚下有足够的内存)

其他信息:

连接字符串是

Provider=msdaora;Data Source=HOSTNAME;User Id=USER;Password=PASSWORD

与OleDb和Oracle.ManagedDataAccess.Client一起使用的连接字符串。

tsnames.ora文件存在(并工作,以显示我与管理员测试程序的成功尝试)

它正在一个较旧的Web服务器上工作,但是我找到任何有意义的(有不同的Windows,32 / 64b,不同的IIS版本,不同的Oracle客户端)

任何想法 ?

I have a server with IIS that hosts web sites. Some of those web sites (Silverlight) must connect to an Oracle Database to perform queries via OleDb, but they cannot.

Here are the results of what I tested :

'msdaora' provider is not registered on local machine when I run it in the web site

ORA-01019: unable to allocate memory in the user side (when I try to connect with a test console program without administrator status)

Connection OK (with the same test console program WITH administrator status)

ORA-12154: TNS:could not resolve the connect identifier specified when trying to switch to another method of connection (from OleDb to Oracle.ManagedDataAccess.Client)

I went through countless info about these kind of errors but I couldn't find any working solution. Here is what I tested :

giving "create global objects" right to the relevant users (no change at all) installing several Oracle clients one after another. Best result is with 10.2 client 64b (where my test program can connect while having administrator rights). The install is clean (no several Oracle folders nor several Oracle environment variables at the same time)

disabling warnings concerning the administrator elevation (ie no confirmation pop up during elevation) : no change at all

checking RAM usage (plenty of memory under the foot)

Additional infos :

The connection string is

Provider=msdaora;Data Source=HOSTNAME;User Id=USER;Password=PASSWORD

Same connection string used with OleDb and Oracle.ManagedDataAccess.Client.

The tsnames.ora file exists (and works, as show my succesful attempt with the administrator test program)

It's working on an older web server, but there are too much differences for me to find any meaningful one (different Windows, 32/64b, different IIS versions, different Oracle client)

Any idea ?

最满意答案

有几点:

针对OLE DB的Microsoft msdaora提供程序已弃用了很msdaora 。 您应该更喜欢Oracle提供商OraOLEDB.Oracle 。

Oracle客户端 OLE DB提供程序 IIS应用程序必须具有相同的体系结构,即所有必须是32位或64位,您不能混合它们。 (古代msdaora不适用于64位)。 但是,ODP.NET托管驱动程序( Oracle.ManagedDataAccess )适用于32位和64位。

当您使用ODP.NET托管驱动Provider=MSDAORA ,在ConnectionString中不需要Provider=MSDAORA 。 我假设这些属性被忽略,或者你错过了提及它。

Oracle客户端和OLE DB提供程序的版本必须匹配(即使是次要版本)。 由于COM限制,您不能为32位和64位安装多个OLE DB提供程序。

OLE DB中的tnsnames.ora文件的搜索模式与ODP.NET托管驱动程序中的搜索模式不同。 验证以下项目:

OLE DB读取您的注册表以获取TNS_ADMIN值,但ODP.NET托管驱动程序不会。 ODP.NET托管驱动程序使用您的.NET配置文件(即web.config , machine.config )来确定tnsnames.ora文件的位置,但OLE DB没有。 根据文档 ODP.NET托管驱动程序确实考虑到TNS_ADMIN环境变量和文件夹%ORACLE_HOME%\network\admin 。 但是,根据我的测试,无论如何。

关于连接失败取决于“Rus as Administrator”检查Oracle安装文件夹的权限。

There are several points:

Microsoft msdaora provider for OLE DB is deprecated for ages. You should prefer the Oracle Provider OraOLEDB.Oracle.

Oracle Client and OLE DB provider and IIS application have to have the same architecture, i.e. all must be either 32 bit or 64 bit, you cannot mix them. (ancient msdaora is not available for 64 bit). However, ODP.NET Managed Driver (Oracle.ManagedDataAccess) works for both 32 bit and 64 bit.

When you use ODP.NET Managed Driver then Provider=MSDAORA is not needed in ConnectionString. I assume such attributes is ignored or you just missed to mention it.

Version of Oracle Client and OLE DB provider must match (even minor version). Due to COM limitation you cannot install more than one OLE DB provider for 32 bit and 64 bit each.

Search pattern for tnsnames.ora file in OLE DB is different to search pattern in ODP.NET Managed Driver. Verify following items:

OLE DB reads your Registry for TNS_ADMIN value, the ODP.NET Managed Driver does not. ODP.NET Managed Driver uses your .NET config file (i.e. web.config, machine.config) to determine location of tnsnames.ora file, the OLE DB does not. According documentation ODP.NET Managed Driver does take into account the TNS_ADMIN Environment variable and folder %ORACLE_HOME%\network\admin. However, according to my tests it does anyway.

Regarding connection failure is depending on "Rus as Administrator" check permissions of your Oracle installation folder.

更多推荐

本文发布于:2023-07-16 10:04:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1126913.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:连接到   站点   数据库   IIS   Oracle

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!