ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("127.0.0.1"); ISubscriber sub = redis.GetSubscriber(); Console.WriteLine("我要订阅messages"); sub.Subscribe("messages", (channel, message) => { Console.WriteLine((string)message); }); Console.WriteLine("过2s后我就发布"); Thread.Sleep(2000); sub.Publish("messages", "哈哈,你能抓到我吗?"); Console.Read();