在程序中用C#操作WORD运行到这句时(
Word.Document wordDoc = wordApp.Documents.Add(ref ModelFileName, ref objNothing, ref objNothing, ref objNothing);
ModelFileName此为存放WORD的路径)就报错。报错信息如下:无法将类型为“Word.ApplicationClass”的 COM 对象强制转换为接口类型“Word._Application”。此操作失败的原因是对 IID 为“{00020970-0000-0000-C000-000000000046}”的接口的 COM 组件调用 QueryInterface 因以下错误而失败: RPC 服务器不可用。 (异常来自 HRESULT:0x800706BA)。 忘高手指教!谢谢

解决方案 »

  1.   

    是不是 在iis中 你可以试一试。
    <system.web>
        <identity impersonate="true" userName="你的用户名" password="你的密码"/>
        </system.web>
      

  2.   

    web.config里面
    <system.web>
        <identity impersonate="true" userName="你的用户名" password="你的密码"/>
        </system.web>
      

  3.   

    就是一个页面有个按钮 点击按钮在页面中显示事先放在某路径下的WORD文档!!就是这样。。但是我这里加载WORD就上面那个错。开始以为是WORD版本的问题。现在测试觉得不是。。望指教!
      

  4.   

    你引用了Microsoft word 11.0 Object Library没啊..
      

  5.   

    using Word = Microsoft.Office.Interop.Word;呢?如果也引用了 那就不知道了   没遇到过类似的情况..你可以去看看  
    http://blog.csdn.net/lxy_abcde1190/archive/2008/06/26/2589160.aspx
      

  6.   

    还有就是
    http://kongjian.baidu.com/hclred/blog/item/dacba61c420a538887d6b64b.html/cmtid/800c66f034ab87a6a40f52b6
      

  7.   

    类似问题很麻烦,主要问题是:1、权限,IIS权限,Web设计的权限2、读取word时的参数,Word.Document wordDoc = wordApp.Documents.Add(ref ModelFileName, ref objNothing, ref objNothing, ref objNothing); 检查这句话,需要引用的东西都应用好了没有。看一下Office开发专题,不过目前还没发到Word核心方面。希望有助帮。http://www.bbs180.com/showforum-44.aspx
      

  8.   

    还有人知道吗。。我刚做了个C#操作EXCEL的例子可以,就是WORD不行。很是郁闷呀 
      

  9.   

       using Word = Microsoft.Office.Interop.Word;     
    object oMissing = System.Reflection.Missing.Value;
            Word._Application oWord;
            Word.Document oDoc;
            oWord = new Word.ApplicationClass();
            //oWord.Visible = true;
            object fileName = @"E:\\模板.doc";        oDoc = oWord.Documents.Open(ref fileName,
            ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
            ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
            ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);
    代码如上,运行到oWord.Documents.Open()方法时就报:
    无法将类型为“Word.ApplicationClass”的 COM 对象强制转换为接口类型“Word._Application”。此操作失败的原因是对 IID 为“{00020970-0000-0000-C000-000000000046}”的接口的 COM 组件调用 QueryInterface 因以下错误而失败: RPC 服务器不可用。 (异常来自 HRESULT:0x800706BA)。 真的郁闷的无可救药啦 望高手赐教!
      

  10.   

    您解决了么?
    我用c#操控excel时遇到同样的问题
      

  11.   

    注要是你可能结束了Excel或Word进程引起
      

  12.   

    楼上有办法么,同样是C#操作EXCEL出现问题,权限等设置完成后,每一次读取文件没问题,第二次读取其它文件就不可以,重启IIS后仍是只可以读取一次。