1

I have a WCF service with a CallbackContract. The service is exposed to a Silverlight client using "pollingDuplexHttpBinding" When the Silverlight client is "dead" and the service calls a callback operation, it gets a timeout exception after one minute. How can I set this timeout to be different?

Thanks, Elad

Elad
  • 319
  • 1
  • 2
  • 10

2 Answers2

0

There is a nice article in MSDN related to configuring PollingDuplexHttpBinding:

//Inactivity timeout
PollingDuplexHttpBinding binding = new PollingDuplexHttpBinding();    
//Get default inactivity timeout
TimeSpan defaultInactivityTimeOut = binding.InactivityTimeout;
//Returns default timeout in minutes: 10
string txtDefaultInactivityTimeOut = defaultInactivityTimeOut.Minutes.ToString();    
//Set new inactivity timeout
TimeSpan newInactivityTimeOut = new TimeSpan(0, 5, 0);
binding.InactivityTimeout = newInactivityTimeOut;

UPDATE: Under 'To use PollingDuplexHttpBinding' paragraph of 'How to: Build a Duplex Service for a Silverlight Client' there is web.config based example configuring PollingDuplexHttpBinding.

Hope, this will help.

Anatolii Gabuza
  • 6,184
  • 2
  • 36
  • 54
  • I don't use "MultipleMessagesPerPoll" as in the article as my duplex mode. My understanding that it's not related to my issue - am I wrong? Specifically, regarding the InactivityTimeout: It's about the amount of time the channel can live without any messages sent through it. I don't see how it's related to my question (and I've also tried it...) – Elad Feb 13 '12 at 09:30
0

So it seems that the "SendTimeout" attribute of PollingDuplexHttpBinding does the job:

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

<bindings>

  <pollingDuplexHttpBinding>
    <binding name="myPollingDuplex" sendTimeout="00:00:05"/>
  </pollingDuplexHttpBinding>

</bindings>


<services>
  <service name="Kodak.Pgy.Server.Event.WCFService.EventService" behaviorConfiguration="EventBehavior">

    <!--For duplex communication with the service from silverlight client-->
    <endpoint address="/for-silverlight" binding="pollingDuplexHttpBinding" bindingConfiguration="myPollingDuplex" contract="IEventService"/>

  </service>

</services>
Elad
  • 319
  • 1
  • 2
  • 10