How to handle WCF Duplex timeout?
I've been searching the web for the last two days, but by no means, I can get my WCF Duplex service working. I've created a demo project which can be download from skydrive:
WCFDuplexDemo.zip
For the purpose of minimizing the number of possible error causes, I've decided to just return a short string in the callback handler because then, no max message size limits or whatsoever are exceeded. Normally, my WCF service would need some time (+15mins) to calculate a result and then return it to the client. To simulate this, I've put the executing thread to slepp for 12 minutes in DoWork().
The exception I get always mentions a possible problem with the receiveTimeout
, which should be increased to prevent the problem. However, the receiveTimeout
(and any ot开发者_如何转开发her timeout I know) is set to three hours.
One more thing: I'm using .NET Framework 3.5 SP1 and the problem also occurs when using WsDUalHttpBinding instead of netTcpBinding.
Harrr! For those who encounter the same problem: I think, there is a bug in the .NET 3.5 implementation of WCF. I upgraded to .NET 4 and the problem is solved now.
Have a look here Per-Session Services and also check out the "Session Termination" section on opened page.
Hope this helps
精彩评论