Why doesn’t WCF support service-side timeouts?

前端 未结 3 1387
自闭症患者
自闭症患者 2020-12-14 18:02

We’ve recently discovered that WCF does not support timing out operations on the service side (note, service side, not client side). While the client disconnect

相关标签:
3条回答
  • 2020-12-14 18:10

    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.

    0 讨论(0)
  • 2020-12-14 18:26

    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.

    0 讨论(0)
  • 2020-12-14 18:26

    What about:

    <system.web>
        <httpRuntime executionTimeout="inSeconds"/>
    </system.web>
    
    0 讨论(0)
提交回复
热议问题