How do I prevent a WCF service from enter a faulted state?

前端 未结 6 1610
没有蜡笔的小新
没有蜡笔的小新 2020-12-02 08:23

I have a WCF Service that should not enter the faulted state. If there\'s an exception, it should be logged and the service should continue uninterrupted. The service has a

6条回答
  •  情深已故
    2020-12-02 08:48

    Exceptions will fault the proxy. You can't AFAIK do much about that: don't cause exceptions ;-p

    I'm a little surprised that one-way is still causing a problem, but for swallowing in general, there are 3 aspects:

    1. are you throwing faults? or exceptions? it matters (and should be "faults")
    2. as a hack, you can enable debug exception messages - but turn it off please!!!
    3. are you "using" the service object? I've just blogged on this exact subject... basically, your "using" can swallow the exception. 3 options:

      • don't use "using"
      • subclass the proxy and override Dispose()
      • wrap it, as per the blog

提交回复
热议问题