?
Solved

How to access duplex service in silverlight?

Posted on 2011-04-19
3
Medium Priority
?
240 Views
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);
   }

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

Open in new window


Parts of code from Enterprise service bus:

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

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

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

         <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" />
            <host>
               <baseAddresses>
                  <add baseAddress="http://localhost:11559"/>
               </baseAddresses>
            </host>
         </service>

Open in new window


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

Module:

         _NotificationServiceHost = new ServiceHost(typeof(NotificationModuleService));
         _NotificationServiceHost.Open();

Open in new window


Service(This piece of code is never reached) :

      public void Heartbeat(string msg)
      {
         Debugger.Break();
         _Client = OperationContext.Current.GetCallbackChannel<INotificationDuplexClient>();
         _Client.Receive(message);
      }

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
0
Comment
Question by:pieterjansen
  • 2
3 Comments
 
LVL 5

Expert Comment

by:TomasP
ID: 35442537
Other than the trace log do you have any event/error logs?
0
 

Accepted Solution

by:
pieterjansen earned 0 total points
ID: 36300603
Problem not solved, but closing this post.
0
 

Author Closing Comment

by:pieterjansen
ID: 36327190
Problem not solved, but post can be closed
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

839 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