探测组件
几年前,我开发了一个 Windows 服务应用程序(VB.NET Framework 1.1),它使用 System.Data.OracleClient 访问 Oracle 数据库。
由于该驱动程序给我带来了很多麻烦,所以我想引用 oracle dataprovider (Oracle.DataAccess.dll),它工作得更好。
在我的电脑上一切正常。
问题是当我尝试在服务器(Windows 2000)上发布我的应用程序时。
我无法在该服务器上安装新的 Oracle 数据提供程序,并且存在旧的 Oracle 9.0 安装(我的应用程序引用 Oracle 9.2)。
我已将整个目录 (C:\oracle\ora92\bin) 从我的电脑复制到服务器(未安装),但我不知道如何引用 Oracle 数据提供程序。 我知道这不是一种“干净”的做事方式,但我无法安装新软件。
我已经看到,如果我将我的应用程序(和所有文件)复制到 C:\oracle\ora92\bin 文件夹中,一切都会正常工作。
我想将该目录指定为我的应用程序的探测目录。 我尝试了在网上找到的不同解决方案,但似乎都不起作用。
我想在运行时或在配置文件中设置一个文件夹,以便我的应用程序可以使用其中的程序集(以及所有依赖项)。
我可以将我的应用程序升级为框架 2.0。
谢谢
阿尔贝托
Few years ago I've developed a windows service app (VB.NET framework 1.1) which was using the System.Data.OracleClient to access an Oracle database.
Since that driver has given me lots of troubles I wanted to reference the oracle dataprovider (Oracle.DataAccess.dll) which works much better.
On my PC everything works fine.
The problem is when I try to publish my app on the server (windows 2000).
I can't install the new oracle data provider on that server and there is an old installation of oracle 9.0 (my app references oracle 9.2).
I've copied (no installation) the entire directory (C:\oracle\ora92\bin) from my pc to the server but I don't know how to reference the Oracle data provider.
I know that is not an "clean" way to do things but I don't have the possibility to install new software.
I've seen that if I copy my app (and all the files) in the C:\oracle\ora92\bin folder everything works fine.
I would like to specify that directory as a probing directory of my application.
I've tried different solutions found on the web but none of them seem to work.
I would like to set a folder at runtime or in my config file so that my app can use the assemblies there (and all the dependencies).
I can upgrade my app for the framework 2.0.
Thanks
Alberto
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
反过来做 - 将 Oracle 程序集放入应用程序的根目录中。或者甚至更好 - 将程序集放入服务器上的 GAC 中。用于该目的的实用程序(gacutil)应该可以在服务器上正常运行。
也许这可以帮助您:C#:自定义程序集目录
如果其他一切都失败,您可以订阅AppDomain 的 AssemblyResolve 事件:
Assembly Resolve
Do it the other way around - put the Oracle assemblies into your application's root. Or even better - put the assemblies into the GAC on the server. the utility used for that (gacutil) should run on the server just fine.
maybe this could help you: C#: Custom assembly directory
if everything else fails, you could subscribe to the AssemblyResolve event of the AppDomain:
Assembly Resolve