2016-04-03 49 views
1

當我運行SSIS包收到此錯誤:如何解決在SSIS包「mongodb.driver」錯誤

腳本組件遇到用戶代碼的異常: 項目名稱:SC_76bc556b4d8343218e4abc8e9ea1e53 未能加載文件或程序集'Mongo.Driver'version = 1.8.3.9,culture = neutral,PublicKeyToken = f686731cfb9cc103'或它的一個依賴關係 系統找不到指定的文件。

但是我也跟着這篇文章,以創建包:https://rajendersehgal.wordpress.com/2015/07/14/data-migration-between-mssql-nosql/

我使用Windows 10和放置Mongodb.driver.dll,MongoDB的。 Bson.dll在程序集文件夾中,然後通過瀏覽框架中的兩個文件來添加引用。

任何建議是可觀的!

回答

1

解決,你需要把蒙戈駕駛者進入GAC庫,see reference(可能會遇到其他一些問題也可能強簽名要求)

First, download and install the C# driver. This next step is important, as there was a change that occurred with version 1.5 of the driver: the DLLs are no longer installed in the GAC (Global Assembly Cache) automatically. They must be there, however, for SSIS to be able to use them.

By default, my drivers were installed to C:\Program Files (x86)\MongoDB\CSharpDriver 1.7. You’ll want to open a CMD window in Administrator mode, and navigate to this folder. Next you’ll need GACUTIL, on my computer I found the most recent version at:

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\

A simple trick to find yours: Since you are already in the CMD window, just move to the C:\Program Files (x86) folder, and do a 「dir /s gacutil.exe」. It will list all occurrences of the program, just use the one with the most recent date. Register the dlls by entering these commands:

「C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\gacutil」 /i MongDB.Bson.dll

「C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\x64\gacutil」 /i MongDB.Driver.dll

Note the 「 quote marks around the path are important for the CMD window to correctly separate the gacutil program from the parameters.

Once that is done, create a new SQL Server Integration Services project in SQL Server Data Tools (SSDT), what used to be called BIDS in SQL Server 2008R2 (and previous). Put a Data Flow Task on the Control Flow design surface. Then open the Data Flow Task for editing.

Next, drag and drop a Script Component transformation onto the Data Flow design surface. When prompted, change the component type to Source.