四种DCOM错误的区别 Differences between the following DCOM error
0x80080005 0x800706be 0x80010105 0x800706ba
0x80080005:CO_E_Server_Exec_FailureServer execution failed
It is usually quite clear: COM (really, RPCSS) tried to launch a particular server process and either it failed to start, or it died after being started without registering (via CoRegisterClassObject), or it failed to register within a timely manner after being started (usually ~2 minutes are allowed, but the time limit can vary by server type).
Repro:比如你有一个程序叫做SimpleDCOM.exe,作为DCOM服务器一切运行正常。如果你把notepad.exe改名为SimpleDCOM.exe,替代掉原先的文件,客户端在调用DCOM的时候就会出这个错。SOX050427700068
0x800706be:PRC_S_CALL_FAILEDThe remote procedure call failed.
The Server crashes before finishing the call.
Repro:重现这个问题很简单。在DCOM的方法中显示一个MessageBox。在dismiss掉这个MessageBox,让DCOM call返回以前,从任务管理器杀死DCOM Server,然后客户端就会看到这个错了。
0x80010105:RPC_E_SERVERFAULTThe server threw an exception
Very straight forward, the server throws an exception.
Repro:DCOM方法中直接抛出一个C++ exception就可以重现这个问题。聪明的你可能会问,为啥米C++ exception不会导致DCOM Server crash呐,那是因为:
"Normally, an exception that happens in a DCOM server during execution of a method call is caught by an exception handler in OLE32.DLL, and the method call returns RPC_E_SERVERFAULT."
如果要改变这个行为,可以参考IgnoreServerExceptions这个注册表键:
0x800706ba:RPC_S_SERVER_UNAVAILABLEThe PRC server is unavaliable
The server stub is disconnected.
Repro:在客户段new一个DCOM object, 暂时不使用。然后重任务管理器中杀死DCOM Server, 然后调用这个DCOM object的方法,错误就出来了