Search code examples
wcfsilverlightpollingduplexhttpbinding

Visual Studio is not generating PollingDuplex Proxy Client


Visual Studio is not creating a constructor for my PollingDuplex proxy. There should be 8 constructors for WCF Client with a constructor including HttpPollingDuplexBinding object and an Endpoint address. But there are only 5 overloads and the client does not have Callback methods. How can I fix this problem?

        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);

Solution

  • This is a known issue as mentioned here

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

    But still can not produce all the constructors. Though I believe this could be an answer for someone who faces this problem.

    Edit:

    Very strange.

    [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();
    }
    

    works fine. But this

    [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);
    
    }
    

    is not working fine here. I have no idea but I'm changing nothing but this and getting a proxy with callback functions.