Jean-Dirk Stuart's Blog

Posts Tagged ‘polling duplex

Polling duplex WCF service slows down normal WCF service calls with AspNetCompatibility enabled

with 2 comments

We’re developing an application that makes extensive use of the polling duplex service offered by WCF for Silverlight. It’s a rather big application hosted on IIS and it requires AspNetCompatibility to be enabled. Other “normal” WCF services run concurrent to the duplex service on the same server in the same domain space and all of these services needs to be consumed by a Silverlight client.


Whenever I enable AspNetCompatibility in the web.config, all calls to the normal WCF services are serviced with a random delay ranging anything from 5 seconds to about a minute. This delay only occurs after the duplex service is connected. It even times out sometimes. This is very frustrating as one sometimes cannot allow for a 10 second delay before requests are processed. (Imagine writing a stock trading application, and the user wanting to buy stocks at a certain price, only to have his request serviced half a minute later. It could have devastating effects.)

After about a week of debugging, I decided to start an application from scratch and implement both a duplex and normal WCF service. After doing so, I was surprised that the problem disappeared.

I then added the global.asax file and immediately the problem popped up again.


I commented out the Session_Start method in global.asax and voila. Everything was back to normal again. All my services are back to responding lightning fast.

I’m not sure why this delay is caused when the Session_Start method is in the global.asax file, but maybe it has something to to with the fact the basicHttpBinding doesn’t support session.

This occurred in both the Beta 2 and RC0 release of Silverlight. I contacted Microsoft about this problem, and will keep you posted as to what they have to say about this issue. Hopefully this will be solved in the Silverlight 2 release, which will hopefully be by the end of the month…


Written by jdstuart

1 October, 2008 at 18:32