10

If I have a session-less binding, are there any circumstances under which the client channel will fault?

In my specific case I have the following custom binding:

<customBinding>
  <binding name="MyCustomBinding">
    <mtomMessageEncoding/>
    <httpTransport/>
  </binding>
</customBinding>

On the client side I'm using the default generated proxies that derive from ClientBase<T>.

I was expecting that if the service threw an unhandled exception that was not a FaultException that it would cause the channel to be faulted and make the client proxy fault as well. However, that is not the case--the proxy still remained in the Open state and was usable afterwards. I also tried violating one of the Binding's timeouts--this also did not fault the channel and the client proxy remained in the Open state.

Is there any situation that will cause the client proxy to become faulted?

Related:

Community
  • 1
  • 1
Matt Smith
  • 17,026
  • 7
  • 53
  • 103

1 Answers1

-1

A ClientChannel transitions to the Faulted-State when an an unrecoverable error occurs. In this state is is not usable anymore. The recovery strategy is to create a new object. Primary reasons are

  • If the Open method fails for any reason, the object transitions to the faulted state.
  • If a session-based channel detects an error that it cannot recover from, it transitions to the faulted state. This can happen for instance if there is a protocol error (that is, it receives a protocol message at an invalid time) or if the remote endpoint aborts the session.

Taken from CommunicationState

session-based referes to a Transport Session. So any unhandled exception will fault the channel, to prevent from using the proxy again after the exception. When there is no transport-level session the client can keep using the proxy after an exception, except again, it should not.

More information about the state changes.

Jehof
  • 34,674
  • 10
  • 123
  • 155
  • Do you know how to cause an "unrecoverable error" with a session-less channel? Can you give an example where the Open method fails and the client channel transitions to the faulted state? Also why do you say "When there is no transport-level session the client can keep using the proxy after an exception, except again, it should not". Why not? – Matt Smith Jun 03 '15 at 14:14