Second wcf polling duplex service call is too long

284 views Asked by At

I have strange problem with WCF service. I use pollingDuplexBinding and Silverlight client. Binding was registred by this code in web.config

<bindingElementExtensions>
   <add name="pollingDuplex" type="System.ServiceModel.Configuration.PollingDuplexElement, System.ServiceModel.PollingDuplex" />
</bindingElementExtensions>

On first call everything is ok - service returns data fast. But second call executes more than 5 mitutes. If I set big timeouts, result will be returned to client, else it throws TimeoutException. WCF method I'm calling does nothing - just returns short string.

WCF tracing says, that second service call just coming 5 minutes later than client calls this method, and executes quickly. I use these service attributes:

[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.Single)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

It's client code

        var binding = new PollingDuplexHttpBinding(PollingDuplexMode.SingleMessagePerPoll);            

        var address = new EndpointAddress("/SportService.svc");
        _proxy = new SportDuplexClient(binding, address);
1

There are 1 answers

0
Emran Sadeghi On

i hade same problem, i solve it in this way :

just set aspNetCompatibilityEnabled="false" to false in web.config file

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" />
</system.serviceModel>

or set sessionState mode="Off" in web.config

<system.web>
    <sessionState mode="Off" />
</system.web>

in both way my problem will solved...