“ZeroMQ.lib.zmq”的类型初始值设定项引发异常。clrzmq4



“ZeroMQ.lib.zmq”的类型初始值设定项引发异常。,clrzmq4

'System.TypeInitializationException' in ZeroMQ.dll("The type initializer for 'ZeroMQ.lib.zmq' threw an exception.")

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


static void Main(string[] args)
        {
            try
            {
                using (var context = ZContext.Create())
                using (var publisher = new ZSocket(context, ZSocketType.PUB))
                {
                    string address = "tcp://*:5556";
                    Console.WriteLine("I: Publisher.Bind'ing on {0}", address);
                    publisher.Bind(address);
 
                    // Initialize random number generator
                    var rnd = new Random();
 
                    while (true)
                    {
                        // Get values that will fool the boss
                        int zipcode = rnd.Next(99999);
                        int temperature = rnd.Next(-55, +45);
 
                        // Send message to all subscribers
                        var update = string.Format("{0:D5} {1}", zipcode, temperature);
                        using (var updateFrame = new ZFrame(update))
                        {
                            publisher.Send(updateFrame);
                            Console.WriteLine(update);
                            System.Threading.Thread.Sleep(1000);
                        }
                    }
                }
 
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
            Console.ReadKey();
        }
 
  
 
  
在bin目录下建立bin\Debug\i386\libzmq.dll
 
  
 
 

你可能感兴趣的:(“ZeroMQ.lib.zmq”的类型初始值设定项引发异常。clrzmq4)