Hello,
I had a problem in one of the tasks, that is when using callbacks with WCF service sometimes the callback faults and causes your service to hang or timeout the request.
The solution to this was to callback your client in a different thread and catch the exception, and then return it to the application in a nice way.
Here's an example for this:
private void YourMethod()
{
//... Do work
//Time to callback one of the clients
BackgroundWorker workerThread = new BackgroundWorker();
workerThread.DoWork += new DoWorkEventHandler(workerThread_DoWork);
workerThread.RunWorkerAsync(callbackObj);
}
static
void workerThread_DoWork(object sender, DoWorkEventArgs e)
{
ICallBackContract callback = e.Argument as ICallBackContr
try
{
callback.CallClientMethod();
}
catch
{
//Do your error handling then
}
}
Cheers,