gpt4 book ai didi

c# - libzmq.dll FileNotFoundException 异常

转载 作者:行者123 更新时间:2023-11-30 16:01:29 28 4
gpt4 key购买 nike

tl;dr 问:“我们如何成功部署 [非托管库] libzmq 以动态加载以支持在 C# 程序中使用的‘ZeroMQ CLR 命名空间’?”

安装了 NuGet pkg ZeroMQ 4.1.0.17(运行时版本 v4.0.30319;版本 4.1.0.42169)的 C# 代码。在 Visual Studio 工作区中运行时工作正常,但是当使用与 ZeroMQ.dll 相同的目录中的 .exe 和包含 libzmq.dll 和 libsodium.dll 的 amd64 子目录部署时 - 甚至复制这两个副本进入与程序和 ZeroMQ.dll 相同的 exec 目录——我们得到:
连接 System.TypeInitializationException:'ZeroMQ.lib.zmq' 的类型初始值设定项抛出异常。 ---> System.IO.FileNotFoundException: UnmanagedLibrary[libzmq] 无法从“C:\Windows\TEMP\libzmq.dll”加载库“libzmq”。检查跟踪输出以获取详细信息。 ---> System.IO.FileNotFoundException: 系统找不到指定的文件。 (HRESULT 异常:0x80070002)
--- 内部异常堆栈跟踪结束 ---
在 ZeroMQ.lib.Platform.Win32.LoadUnmanagedLibrary(字符串库名称)
在 ZeroMQ.lib.zmq..cctor()
--- 内部异常堆栈跟踪结束 ---
在 ZeroMQ.ZContext..ctor()
在 Core.Adapter.ZeroMQ.ZeroMQMessagingService.Connect(String connection_string) 在\ZeroMQMessagingService.cs:line 201

请注意,它说它正在 C:\Windows\TEMP 中查找,但也许这只是链中的最后一个位置。

我们在升级到 ZeroMQ 4.1.0.21 并且无法将 libzmq.dll 作为“嵌入式资源”加载后得到这个,所以我们完全删除了 .21 并返回到 .17。在我们升级到 .21 之前,它在 .17 中运行良好。

复制 如果在 amd64\libzmq.dll 和 libsodium.dll 上选中了 Newer,是的,这是一个尝试在 x64 机器上运行的 x64 构建。失败的主机是运行 .NET 4.5 的 2012 Server。

最佳答案

事实证明这很简单。我们正在转移到一台仍在配置的新机器上,安装 C++ 2010 可再发行组件为我们解决了这个问题。

关于c# - libzmq.dll FileNotFoundException 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38714669/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com