Why does WCF fault the channel when using security?

294 views Asked by At

Background:

I've noticed that in my WCF services, when I throw an Exception (a plain old exception), the client channel enters the faulted state and has to be aborted and re-created before I can make another call on that channel. That's fine. That's how it's intended. I get it. So I just call abort() and re-create if I need to make another call.

However, faulting of the client channel only happens when I'm using a binding that has security enabled. When I use basicHttpBinding, I can get an exception on the client, and then keep using the ServiceClient object without it telling me it's in "the faulted state".

Also, when I turn off security on wsHttpBinding or netTcpBinding, I can re-use the channel after an Exception.

Question:

What is is about a binding's security that makes it fault the channel so it's unusable?

1

There are 1 answers

0
James Osborne On

This is because with Security, you are setting up a secure session. When you throw out of that session, the channel enters the faulted state and you have to abort it and create a new one. With BasicHttpBinding, there's no session going on.