2010-12-06 68 views
0


虽然这是一件简单的事情,我不知道该怎么做。
我想签署的dll发生在服务器端的事件。
客户端有一个这个DLL的实例,他们必须从服务器接收通知。
上的服务我定义(C#):
从WCF服务提高事件到消费DLL

public delegate ActionResult ActionComplitedHandler(object sender,ActionComplitedEventArgs e); 

public event ActionComplitedHandler ActionComplited; 

     public void OnActionComplited(ActionResult actionResult) 
     { 
      if (ActionComplited != null) 
      { 
       ActionComplitedEventArgs args = new ActionComplitedEventArgs(); 
       args.ActionResult = actionResult; 
       ActionComplited(this, args); 
      } 
    } 

但是,当试图签署DLL的事件我不能看到它。

mySeriveInstance.ActionComplited+=... //(I don't get the eventHandler after the dot) 

我不喜欢使用WCF回调。
WCF服务实例是Single。
我做错了什么,有没有其他方法可以做到这一点?
谢谢。

+0

你不能使用自动完成或不能接收事件? – 2010-12-06 07:45:32

回答

0

有两种基本的方法可以做到这一点:

1)您可自托管在客户端应用程序WCF服务,并在呼叫服务器传中,客户机的IP地址。然后,服务器可以构建一个代理,并在想要发送事件时回拨给客户端。

2.)您可以频繁地从服务器轮询事件。为每个客户端提供服务响应中的标识符,然后他们每隔一段时间就可以使用该标识符来调用服务器。您可以在服务器端使用缓存来存储未传送的事件列表,然后当客户端点击该链接时,您将为客户端返回最旧的事件。