public virtual IMessage SyncProcessMessage(IMessage msg)
{
IMethodCallMessage mcmReqMsg = (IMethodCallMessage)msg;
IMethodReturnMessage replyMsg = null;
replyMsg = RemotingServices.ExecuteMessage(_comObject, mcmReqMsg);
if (replyMsg != null)
{
// If an "RPC server not available" (HRESULT=0x800706BA) COM
// exception is thrown, we will try to recreate the object once.
const int RPC_S_SERVER_UNAVAILABLE = unchecked((int)0x800706BA);
const int RPC_S_CALL_FAILED_DNE = unchecked((int)0x800706BF);
COMException comException = replyMsg.Exception as COMException;
if ((comException != null) &&
((comException._HResult == RPC_S_SERVER_UNAVAILABLE) ||
(comException._HResult == RPC_S_CALL_FAILED_DNE)))
{
_comObject = (MarshalByRefObject)Activator.CreateInstance(_serverType, true);
replyMsg = RemotingServices.ExecuteMessage(_comObject, mcmReqMsg);
}
}
return replyMsg;
} // SyncProcessMessage