Why doesn’t WCF support service-side timeouts?
If you have bad code that runs forever, timing it out may only make things worse. Fix the bad code if at all possible! See Eric Lippert's article, Careful with that axe, about these sorts of situations.
If this is in development, you might want to try setting up a System.Threading.Timer
that calls serviceCallThread.Abort()
within your service implementation. However, be sure you've disarmed the timer thoroughly before you return -- this approach is insanely error-prone, due to a mix of concurrency issues, not owning the thread on which the service call arrives, oddball behavior of ThreadAbortException
, and the issues Eric explains about blindly terminating code that's gone off in the weeds.
I've noticed this problem myself... I can't think of a good reason why they won't include service-side operation timeouts as part of the platform.