public void CallServerOp() { this.m_cb = OperationContext.Current.GetCallbackChannel <ICallback>(); rand = new Random(); // 生成随整数,并回调到客户端 // 每隔3秒生成一次 timer = new Timer( (obj) => { var value = rand.Next(); m_cb.CallClient(rand.Next()); WriteFile(string.Format("调用客户端回调方法,发送值为{0}", value)); }, null, 10, 3000); }