Hi,
I'm submitting SOA jobs to the HPC scheduler, everything is working fine, I'm getting call back returns, no problem.
I run some tests to see what happens when the client code throws exceptions, and that works fine too, I catch the exceptions in the call back method. However, after all the calls backs are received, I attempt to do a client.Close( ), and I get this exception:
"The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state."
What do I need to do to properly close/dispose of the client object, if any of the client calls threw exceptions?
thanks!
Damian
P.s .the code is simple, based on MS examples
int j = 0;
foreach (string job in jobdetails)
{
client.BeginExecuteJobRequest(job, SimJobCallBack, new RequestSimState(client, j++));
}
AsyncResultsDone.WaitOne();
client.Close();
}
catch (Exception e)
{
string msg = e.Message;
}
call back method:
static void SimJobCallBack(IAsyncResult result)
{
RequestSimState state=null;
int startPath=-1;
try
{
state = result.AsyncState as RequestSimState;
startPath = state.StartingPath;
string rc = state.GetResult(result);
Console.WriteLine(string.Format("Returned for startPath {0} = {1}", startPath, rc));
}
catch (Exception e)
{
string errorMsg = e.Message;
Console.WriteLine(string.Format("Exception for startPath {0} = {1}", startPath, errorMsg));
}
finally
{
if (Interlocked.Decrement(ref jobCount) <= 0)
AsyncResultsDone.Set();
}
}