views:

17

answers:

0

I have a Duplex service (Singleton), which used to work with WSDualHttpBinding, and after changing it to duplex CustomBinding to support BinaryEncoding for performance reasons, it stopped working. The problem traces to GetCallBackChannel always returns with same HashCode (within that service instance) for all the client requests and the List thinks it already exists in the subscribed channels and wont add to the Subscribers list. I am using C# 3.5

Please suggest a solution..

Thanks in Advance...

public void Subscribe(string topicName)
            {
                try
                {
                    Notifier.IPublishing subscriber = OperationContext.Current.GetCallbackChannel<IPublishing>();
                    Notifications.Filter.AddSubscriber(topicName, subscriber);
                }
                catch (Exception ex)
                {
                    ErrorLog.WriteToLog("Subscribe\n" + ex.ToString());
                }
            }

static public void AddSubscriber(String topicName, IPublishing subscriberCallbackReference)
        {
            lock (typeof(Filter))
            {                
                if (SubscribersList.ContainsKey(topicName))
                {
                    if (!SubscribersList[topicName].Contains(subscriberCallbackReference))
                    {
                        SubscribersList[topicName].Add(subscriberCallbackReference);
                    }
                }
                else
                {
                    List<IPublishing> newSubscribersList = new List<IPublishing>();
                    newSubscribersList.Add(subscriberCallbackReference);
                    SubscribersList.Add(topicName, newSubscribersList);
                }
            }
        }