How to access duplex service in silverlight?

Posted on 2011-04-19
Last Modified: 2012-05-11
Hello everyone,

I have a problem with accessing duplex service in Silverlight. From what I've seen in trace viewer, service is established but client didn't contact this service at all.

This is how proxy look like:

   [ServiceContract(Name = "NotificationDuplexService", CallbackContract = typeof(INotificationDuplexClient))]
   public interface INotificationDuplexService
      [OperationContract(IsOneWay = true)]
      void Heartbeat(string msg);

   public interface INotificationDuplexClient
      [OperationContract(IsOneWay = true)]
      void Receive(NotificationMessage msg);

Open in new window

Parts of code from Enterprise service bus:

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

            <binding  name="myPollingDuplex" duplexMode="MultipleMessagesPerPoll"  maxOutputDelay="00:00:01">

            <behavior name="psbBehavior">
               <serviceMetadata httpGetEnabled="true"/>
               <serviceDebug includeExceptionDetailInFaults="True" />
               <dataContractSerializer />
               <serviceThrottling maxConcurrentSessions="1024" />

         <service name="Prodigy.Esb.Modules.Notification.NotificationModuleService" behaviorConfiguration="psbBehavior">
            <!-- Endpoint for Silverlight access policy -->           
            <endpoint address="" binding="pollingDuplex" bindingConfiguration="myPollingDuplex" contract="Prodigy.Proxies.INotificationDuplexService" />
            <!-- Mex binding used for meta data exchange -->
            <endpoint address="mex" binding="mexHttpBinding" name="MetadataBinding" contract="IMetadataExchange" />
                  <add baseAddress="http://localhost:11559"/>

Open in new window

Service (NotificationModuleService) is in module (NotificationModule). Below are related parts to this issue.


         _NotificationServiceHost = new ServiceHost(typeof(NotificationModuleService));

Open in new window

Service(This piece of code is never reached) :

      public void Heartbeat(string msg)
         _Client = OperationContext.Current.GetCallbackChannel<INotificationDuplexClient>();

Open in new window

On client side I create service reference and made proxy this way:

EndpointAddress address = new EndpointAddress("http://localhost:11559/");
         PollingDuplexHttpBinding binding = new PollingDuplexHttpBinding(PollingDuplexMode.MultipleMessagesPerPoll);

         _Proxy = new Prodigy.UI.Infrastructure.ServiceReference.NotificationDuplexServiceClient(binding, address);

Open in new window

And finally this is call for Heartbeat:

      public void Heartbeat()
         _Proxy.HeartbeatAsync("This is the test message");

Open in new window

Thank you for your advices,

Pieter Jansen
Question by:pieterjansen
    LVL 5

    Expert Comment

    Other than the trace log do you have any event/error logs?

    Accepted Solution

    Problem not solved, but closing this post.

    Author Closing Comment

    Problem not solved, but post can be closed

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
    In Easy String Encryption Using CryptoAPI in C++ ( I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now