Friday, 29 May 2015

Exception Handling in WCF - Unhandled Exception in WCF

An unhandled exception in wcf service, will cause the communication channel to fault and the session will be lost.Once a communication channel is in faulted state, we can not use the same instance of the proxy class any more. we have to create a new instance of the proxy class.But this is not true for basicHttpBinding.

BasicHttpBinding does not have session, so when there is unhandled exception, it only fault the server channel.the client proxy is still OK, because with BasicHttpBinding the channel is not maintaining sessions and when the client calls again it is not expecting the channel to maintain any session.

wsHttpBinding has secure session, so when there is an unhandled exception, it fault the server channel.At this point the client proxy is useless as it is also faulted.
because with wsHttpBinding the channel is maintaining a secure session and when the client calls again it expects the channel to maintain the same session.The same session does not exist at the server channel any more, as the unhandled exception has already torn down the channel and the session along with.

If You are using wsHttpBinding, if any unhandled exception occur in wcf service, after that you can not use same client proxy object.At that case you must have to re-instantiate proxy object.

Related Post :

Different-option-of-hosting-wcf-service
Binding-in-wcf-choosing-right-wcf
Exchanging-metadata-in-wcf
Some-interesting-facts-about-data-contract
Knowntype-attribute-in-wcf
Associating-knowntype-in-wcf
Message-contract-in-wcf
Exception-handling-in-wcf
Exception Handling in WCF - SOAP Fault in WCF
Exception Handling in WCF - Unhandled Exception in WCF
Exception Handling in WCF - Creating and Throwing Strongly Typed SOAP Fault

No comments:

Post a Comment