从将部署到 GAC 的自定义 .Net 数据提供程序调用非托管代码时,我应该在哪里部署要使用的 DLL?
我已经构建了一个自定义 .Net 数据提供程序,并且正在尝试部署它,以便我可以在 SQL Integration Services (SSIS) 中使用它。我遇到的问题是我引用了 Win32 DLL 中的非托管方法。为了使我的数据提供程序能够在 SSIS 中工作,我必须签署我的托管提供程序 DLL 并将其部署到全局程序集缓存 (GAC)。当我尝试在 Business Intelligence Development Studio (BIDS) 中使用我的数据提供程序时,出现以下错误:
TITLE: Connection Manager
------------------------------
Test connection failed because of an error in initializing provider. Unable to load DLL 'RTB32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
------------------------------
BUTTONS:
OK
------------------------------
我应该如何/在哪里将非托管代码与我的提供程序一起部署,以便它可以工作?我尝试过的事情:
- 将 DLL 嵌入到托管 DLL 中。
- 将非托管 DLL 添加到 GAC。
- 将非托管 DLL 的位置添加到 PATH 系统变量中。
- 将非托管 DLL 放入 System32 目录(出于绝望)
旁注:当我在 Forms 应用程序中使用数据提供程序并将非托管和托管程序集放在同一目录中时,一切正常,没有任何问题。
旁注 2:我希望这个数据提供程序能够在 SSIS 以外的更多地方工作。我还希望它能够作为 SQL Server 中的链接服务器、SSRS 中的数据源、Visual Studio 的数据源、实体框架等。我更愿意将 DLL 放在一个可以使用的地方所有这些。
谢谢!
克里斯
I have build a custom .Net Data Provider and am in the process of trying to deploy it so that I can use it in SQL Integration Services (SSIS). The issue that I am running into is that I am referencing unmanaged methods in a Win32 DLL. In order for my Data Provider to work in SSIS, I have to sign my managed provider DLL and deploy it to the Global Assembly Cache (GAC). When I try to use my Data Provider in Business Intelligence Development Studio (BIDS), it gives me the following error:
TITLE: Connection Manager
------------------------------
Test connection failed because of an error in initializing provider. Unable to load DLL 'RTB32.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
------------------------------
BUTTONS:
OK
------------------------------
How/where am I supposed to deploy the unmanaged code along with my provider so that it works? Things I have tried:
- Embedding the DLL's into the managed DLL.
- Adding the unmanaged DLL's to the GAC.
- Adding the location of the unmanaged DLL's to the PATH System Variable.
- Putting the unmanaged DLL's into the System32 directory (out of desperation)
Side Note: When I use my Data Provider in a Forms app with the unmanaged and managed assemblies in the same directory, everything works without any issues.
Side Note 2: I want this Data Provider to work in more places that just SSIS. I also want it to work as a Linked Server in SQL Server, as a Data Source in SSRS, as a Data Source for Visual Studio, in the Entity Framework, etc. I would prefer to put the DLL's in one place that will work for all of these.
Thanks!
Chris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果这是在 64 位操作系统上运行的 32 位应用程序,则您需要将 DLL 安装在
C:\Windows\SysWOW64
目录中。否则,它们应该进入
C:\Windows\System32
。显然,在这两种情况下,您都需要为要安装的计算机使用适当的驱动器和目录。
If this is a 32-bit app running on a 64-bit OS, then you will need to install the DLLs in the
C:\Windows\SysWOW64
directory.Otherwise, they should go into
C:\Windows\System32
.In both cases, obviously, you would need to use the appropriate drive and directory for the machine you are installing on.