0

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

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

1 回答 1

0

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.

于 2012-10-02T21:05:50.337 回答