1

Silverlight5クライアントによって使用されるデュプレックスサービスを作成しています。私のサーバー構成は次のようになります(明らかに適切な場所にあります)-

            <bindingExtensions>
                <add name="pollingDuplexHttpBinding"
                     type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement, System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
            </bindingExtensions>

<pollingDuplexHttpBinding>
                <binding name="multipleMessagesPerPollPollingDuplexHttpBinding"
                         duplexMode="MultipleMessagesPerPoll"
                         maxOutputDelay="00:00:07"/>
            </pollingDuplexHttpBinding>

<endpoint address="Duplex"
                          binding="pollingDuplexHttpBinding"
                          bindingConfiguration="multipleMessagesPerPollPollingDuplexHttpBinding"
                          contract="ProActive.Domain.Interfaces.IDuplexService"/>

あなたが見る契約はこれです-

[ServiceContract(Name = "IDuplexService", CallbackContract = typeof(IDuplexClient))]
    public interface IDuplexServiceAsync
    {
        [OperationContract(AsyncPattern = true)]
        IAsyncResult BeginConnect(int userId, AsyncCallback callback, object asyncState);

        void EndConnect(IAsyncResult result);
    }

[ServiceContract]
public interface IDuplexClient
{
    [OperationContract(IsOneWay = true)]
    void Refresh();
}

これは問題なくホストされているようですが、100%確信はありません。

私のクライアントコードは次のようになります-

public class client : IDuplexClient
{
    #region IDuplexClient Members

    public void Refresh()
    {

    }

    #endregion
}



 public someOtherClass
    {
var binding = new PollingDuplexHttpBinding();
            binding.DuplexMode = PollingDuplexMode.MultipleMessagesPerPoll;

            var address = new EndpointAddress("http://" + ConfigService.ServerName + "/Service.svc/Duplex/");

            var factory = new DuplexChannelFactory<IDuplexServiceAsync>(
                new InstanceContext(new client()), binding).CreateChannel(address);
            factory.BeginConnect(0, new AsyncCallback((result) =>
                {
                    factory.EndConnect(result);

                }), null);

    }

'factory.EndConnect(result)'をステップオーバーすると、ContractFilterの不一致の問題が発生しますが、理由がわかりません。明らかにサーバー上で非同期バージョンの同期バージョンを実装しています(つまり、Begin / EndConnectではなくConnectだけです)が、ここで不一致のコントラクトがあると考えることができるのはそれだけです。

私は今本当に髪を抜いています...そして私はすでにハゲです!どんな助けでも本当にありがたいです。

前もって感謝します。

4

2 に答える 2

0

また、SL 5 を使用しているため、そのバージョンを 4.0.0.0 から 5.0.0.0 に変更することを忘れないでください (c:\Program Files (x86)\Microsoft SDKs\Silverlight から正しい System.ServiceModel.PollingDuplex アセンブリを読み込んでいると思います)。 \v5.0\Libraries\Server)

于 2013-09-26T16:16:50.573 に答える