2012-10-02 73 views
0

Visual Studio没有为我的PollingDuplex代理创建构造函数。 WCF客户端应该有8个构造函数,其构造函数包括HttpPollingDuplexBinding对象和端点地址。但是只有5个重载,并且客户没有回调方法。 我该如何解决这个问题?Visual Studio没有生成PollingDuplex代理客户端

 var address = new EndpointAddress("http://" 
      + App.Current.Host.Source.DnsSafeHost 
      + ":" 
      + App.Current.Host.Source.Port.ToString(CultureInfo.InvariantCulture) 
      + "/PService.svc"); 
     return new ServiceClient(binding, address); 

回答

0

这是这里提到

http://blogs.msdn.com/b/silverlightws/archive/2010/04/04/some-known-wcf-issues-in-silverlight-4.aspx

但至今仍无法生产的所有构造函数的已知问题。虽然我相信这可能是面对这个问题的人的一个答案。

编辑:

很奇怪。

[ServiceContract] 
public interface IMyCallback 
{ 

    [OperationContract(IsOneWay = true, AsyncPattern = true)] 
    IAsyncResult BeginNotify(Message message, AsyncCallback callback, object state); 
    void EndNotify(IAsyncResult result); 

    [OperationContract(IsOneWay = true)] 
    void OnX(); 
} 

工作正常。但是这

[ServiceContract] 
public interface IPokerClient 
{ 

    [OperationContract(IsOneWay = true)] 
    void OnX(); 

    [OperationContract(IsOneWay = true, AsyncPattern = true)] 
    IAsyncResult BeginNotify(Message message, AsyncCallback callback, object state); 
    void EndNotify(IAsyncResult result); 

} 

在这里工作不好。我不知道,但我只是改变了这一点,并得到一个代理回调函数。

相关问题