I have a WCF service and my client is a Silverlight application. When the service goes down (network error etc.) then I get this exception on the client proxy:
CommunicationException: The communication object, System.ServiceModel.Channels.ClientFramingDuplexSessionChannel, cannot be used for communication because it is in the Faulted state.
to be precise, on the 5th line of the code below:
public System.IAsyncResult BeginPublishVideo(byte[] data, System.AsyncCallback callback, object asyncState) {
object[] _args = new object[1];
_args[0] = data;
//Below is when the exception is received
System.IAsyncResult _result = base.BeginInvoke("PublishVideo", _args, callback, asyncState);
return _result;
}
So I've tried wrapping up the service call (from the stack trace) in a try/catch but to no avail, the try/catch doesn't ever get executed. Basically this:
try
{
_videoClient.PublishVideoAsync(codedVideoBuffer);
}
catch (Exception) { }
But the try catch never gets hit. How can I catch this exception and deal with it gracefully?
TIA.