未处理的异常: System.Runtime.InteropServices.COMException (0x800706BA): RPC 服
务器不可用。 (异常来自 HRESULT:0x800706BA)
在 Microsoft.Office.Interop.Word.ApplicationClass.Quit(Object& SaveChanges, O
bject& OriginalFormat, Object& RouteDocument)
在 xxxServer.Program.Main(String[] args)
原因是当A进程在读写word内容的时候,WinWord.exe进程被别的软件关闭了造成的。
当我们会多线程操作多个wod的时候,注意不要使用下面的语句,下面的语句是关闭winword.exe进程的命令。
_Application oWord = new Application();
object saveOption = WdSaveOptions.wdSaveChanges;
oWord.Quit(ref saveOption, ref oMissing, ref oMissing);