2016-08-02 161 views
2

TL;醫生問:「我們如何成功部署[非託管庫] libzmq動態加載,以支持‘ZeroMQ CLR命名空間’在C#程序被使用?」安裝;帶的NuGet PKG ZeroMQ 4.1.0.17libzmq.dll FileNotFoundException異常

C#代碼(版本4.1.0.42169運行版本v4.0.30319)。在Visual Studio工作區中工作得很好,但是當與ZeroMQ.dll相同的目錄下部署.exe時,以及包含libzmq.dll和libsodium.dll的amd64子目錄時 - 甚至將這兩個副本都複製到到相同的exec目錄中的程序和ZeroMQ.dll - 我們得到: Connect System.TypeInitializationException: The type initializer for 'ZeroMQ.lib.zmq' threw an exception. ---> System.IO.FileNotFoundException: UnmanagedLibrary[libzmq] Unable to load library "libzmq" from "C:\Windows\TEMP\libzmq.dll". Inspect Trace output for details. ---> System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002) --- End of inner exception stack trace --- at ZeroMQ.lib.Platform.Win32.LoadUnmanagedLibrary(String libraryName) at ZeroMQ.lib.zmq..cctor() --- End of inner exception stack trace --- at ZeroMQ.ZContext..ctor() at Core.Adapter.ZeroMQ.ZeroMQMessagingService.Connect(String connection_string) in \ZeroMQMessagingService.cs:line 201

注意是說,它正在尋求在C:\ WINDOWS \ TEMP,但也許這只是在鏈中的最後一個地方。

我們升級到ZeroMQ 4.1.0.21,未能加載libzmq.dll爲「嵌入的資源」後,得到這個,所以我們完全除去0.21,並返回到0.17。在升級到0.21之前,它在.17中運行良好。

複製如果更新的版本在AMD64 \ libzmq.dll和libsodium.dll,是的,這是一個64位編譯試圖在x64機器上運行的檢查。失敗的主機是運行.NET 4.5的2012 Server。

回答

2

原來這很簡單。我們正在轉向一臺仍在配置的新機器,並且安裝C++ 2010可再發行版本解決了我們的問題。

+0

是的...在Windows上,它是MSVC2010 redist。在GNU/Linux上是GCC48。 – metadings

+0

我與2010版redists有同樣的問題。在Visual Studio 2015下,我的zeromq代碼可以正確運行IIS Express,但是當我將它發佈到IIS時,服務器會拋出異常,說它無法在它存在的所有位置找到libzmq.dll,包括c:\ windows \ system32 – wilsotc

+0

@wilsotc只是猜測推斷你的IIS機器需要2015年的redists,那麼呢? – koan911

相關問題