问题描述
我们有一个部署使用ClickOnce一个SQLServer(WinForms的)应用程序直接交谈数据库。如果我们被迫将它移植到Oracle,ODP.NET可以一起使用的ClickOnce。
(该用户可能没有在他们的电脑管理员权限)
背景
此数据导入应用程序在每个客户的站点中的少数用户,它使用intergraded的登录连接到SQL Server。大多数用户访问系统无功的Asp.net应用程序,或者一个WinForms(ClickOnce的)应用程序,会谈到Web服务。
又见How编写.Net应用程序,与双方的SqlServer和Oracle
工作编辑:我已经修改这个答案的现代化。此外,为了澄清,ClickOnce是仅仅是一个应用程序部署工具,如何使用Oracle客户端和ODP.Net您的应用程序仍然由架构决定的。以下是最常见的情况概要:
智能客户端应用程序(例如,客户端应用程序+ Web服务)
您的ClickOnce部署的客户端应用程序安装在用户的机器,但说话的某种服务的使用数据。在这种情况下,您的客户端应用程序并不需要分发的Oracle客户端或ODP.Net。
Oracle客户端和ODP.Net包应通过机器承载后端服务于甲骨文的正常说明书安装,并从该项目/应用程序的任何其他库引用将用于/分发。
胖客户端瘦部署应用程序(如胖客户端在Citrix)
您的ClickOnce部署客户机应用程序是胖,它包括其自己的数据层,因此必须能够经由本地安装的客户端连接Oracle,并能够以引用ODP.Net库。对>
在这种情况下,Oracle客户端和ODP.Net包应安装使用Oracle的标准说明托管设备(例如思杰箱)上,和你的应用程序应该引用安装了主机计算机上相应的库。
胖客户端胖部署应用程序(例如,在用户计算机胖客户端)
在这种情况下,你的应用是一个典型的胖客户端,因为它有它自己的数据层,需要能够与Oracle客户端和ODP.Net库进行通信。
我们在这里讨论的具体方案是如何将您的应用程序中分发Oracle客户端和ODP.Net(例如,当你的用户没有安装这些产品在他们的机器)。下面是说明:
-
下载 Oracle数据访问组件包。
(一)目前的版本是ODAC 11.2第4版(11.2.0.3),并包括对微软实体框架4.
支持(B)您需要32位版本ODP.Net安装为Visual Studio中的是一个32位应用程序。然后,您可以编译成目标处理器,当您部署位版本。
-
在ODAC包是Oracle即时客户端和ODP.Net库。你需要即时客户端库复制到您的应用程序,将它们设置为一直拷贝
-
参考的 Oracle.DataAccess.Client 的像使用任何其他lib和设置
复制本地=真
。 -
您的连接字符串,看起来有点象一个<$ C $ C> TNSNAMES.ORA 文件常规条目:
数据源=(DESCRIPTION =(ADDRESS =(PROTOCOL = TCP)(HOST =主机名)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SID = oracle_world_here) ));用户ID = schema_here;密码= password_here;坚持安全信息= TRUE;
备注
一个。有即时客户端的两个主要版本 - 完整版(约115MB),其中包括多语言支持,而精简版的版本(约28MB)与仅支持英语
。乙。 重要的确保部署的库都来自客户端的相同版本 - 如果部署32位ODP.Net你要部署32位的即时客户端库的意思。如果使用11.2即时客户端,您不能使用11.0 ODP.Net等 - 愚蠢,但很多人忽视了这一点;使用良好的源代码控制。
℃。我的经验,以下库放置在我的项目的根目录下(为了避免与权限或%PATH%的任何问题)
OCI.DLL,OCIW32.DLL,orannzsbb11.dll,oraocci11.dll,oraociicus11.dll,oraops11w.dll
总结&放大器;结果:
现在你可以使用的ClickOnce部署的所有Windows客户端应用程序 - 脂肪,事情或智能
We have a sqlserver (WinForms) application that is deployed with ClickOnce that talks directly to the database. If we are forced to port it to oracle, can ODP.NET be used with ClickOnce.
(The users may not have admin rights on their PCs)
Background
This data import application is used by a handful of users at each customer’s site it uses intergraded logon to connect to SQL Server. Most users access the system var an Asp.net application, or a WinForms (clickOnce) application that talks to a web service.
see also "How to write a .Net application that works with both SqlServer and Oracle "
EDIT: I have revised this answer for modernization. Also, to clarify, ClickOnce is merely an application deployment tool, how to use Oracle Client and ODP.Net with your application is still determined by architecture. Here's a summary of the most common scenarios:
Smart Client Apps (ex. Client App + Web Service)
Your ClickOnce-deployed client application is installed on users' machines, but speaks to some sort of service to work with data. In this scenario, your client application does not need to distribute an Oracle Client or ODP.Net.
The Oracle Client and ODP.Net package should be installed via Oracle's normal instructions on the machine hosting the back-end service, and referenced from that project/application as any other library would be used/distributed.
Fat Client "Thin Deployment" Apps (ex. "fat client" on Citrix)
Your ClickOnce-deployed client application is "fat" in that it includes its own data layer, and therefore must be able to connect to Oracle via a locally installed client, and able to reference the ODP.Net libraries.
In this scenario, the Oracle Client and ODP.Net packages should be installed on the hosting machine (ex. Citrix box) using Oracle's standard instructions, and your application should reference the appropriate libraries installed on its hosting computer.
Fat Client "Fat Deployment" Apps (ex. fat-client on users' machines)
In this scenario, your application is a typical "fat client" in that it has its own data layer and needs to be able to communicate with the Oracle Client and ODP.Net libraries.
The particular scenario we're discussing here is how to distribute Oracle Client and ODP.Net within your application (ex. when your users do not have these products installed on their machines). Below are instructions:
Download the Oracle Data Access Components package.
(A) the current version is ODAC 11.2 Release 4 (11.2.0.3) and includes support for Microsoft Entity Framework 4.
(B) You will need the 32-bit version of ODP.Net installed as Visual Studio is a 32-bit application. You can then compile to a target processor and bit version when you deploy.
In the ODAC package are the Oracle Instant Client and ODP.Net libraries. You need to copy the instant client libraries to your application and set them to "Copy Always"
Reference Oracle.DataAccess.Client like you would any other lib and set
Copy Local = True
.Your connection string should look much like a normal entry in a
TNSNAMES.ORA
file:Data Source=(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED) (SID = oracle_world_here)));User Id=schema_here;Password=password_here;Persist Security Info=TRUE;
Notes
A. There are two main versions of the instant client - the full version (approx. 115mb) which includes multiple language support, and the Lite version (approx. 28mb) with support for only English.
B. IMPORTANT Ensure the libraries deployed are all from the same version of the client - meaning if you deploy 32-bit ODP.Net you have to deploy 32-bit instant client libs. If you use 11.2 instant client, you cannot use 11.0 ODP.Net, etc. -- silly but lots of people overlook this; use good source control.
C. My experience, the following libraries were placed in the root of my project (to avoid any issues with permissions or %PATH%)
oci.dll, ociw32.dll, orannzsbb11.dll, oraocci11.dll, oraociicus11.dll, oraops11w.dll
Summary & Results:
You can now use ClickOnce deployments for all Windows Client applications - fat, thing, or smart.
这篇关于ODP.NET和ClickOnce的可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!