检索COM类工厂组件的错误而生成的Word文档 [英] Retrieving the COM class factory for component error while generating word document

查看:177
本文介绍了检索COM类工厂组件的错误而生成的Word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从编辑使用VB.NET在大多数情况下这code的Word文档:

I am trying to edit a word document from VB.NET using for the most part this code:

如何到Word从Visual Basic .NET自动创建一个新的文件
http://support.microsoft.com/kb/316383

它工作在我的机器上的罚款,但是当我发布到服务器我得到下面的错误。

It works fine on my machine but when i publish to the server i get the following error.

检索COM类工厂
  与CLSID组件
  {000209FF-0000-0000-C000-000000000046}
  由于以下错误失败:
  80070005。

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005.

说明:期间,出现未处理的异常
  当前Web请求的执行。
  有关详情,请堆栈跟踪
  有关该错误以及信息
  它起源于code。

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

异常详细信息: System.UnauthorizedAccessException的:
  检索COM类工厂
  与CLSID组件
  {000209FF-0000-0000-C000-000000000046}
  由于以下错误失败:
  80070005。

Exception Details: System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005.

当我尝试只创建一个Word应用程序对象发生的实际误差

The actual error happens when i try to just create a word application object

 Dim oWord As New Word.Application

使用Visual Studio 2008和VB.NET 3.5。我做了一个参考的Microsoft Word 10.0对象库,我看到的bin目录Interop.Word.dll文件。

Using Visual Studio 2008 and VB.NET 3.5. I made a reference to the "Microsoft Word 10.0 Object Library" and i see Interop.Word.dll file in the bin directory.

开发计算机和Windows Server 2003

Using MS Office 2003 on development machine and Windows Server 2003

还是相当新的.NET和没有关于窗口服务器多少知识,而是出现UnauthorizedAccessException听起来像一个权限问题。我想知道,如果有人可以上我可能需要做给我用字的小应用程序访问正确的方向指向我。

Still fairly new to .NET and don't have much knowledge about window server, but "UnauthorizedAccessException" sounds like a permission issue. I'm wondering if someone could point me in the right direction on what i might need to do to give my little application access to use word.

推荐答案

这肯定听起来像一个权限问题。你运行你的code在一个窗口服务?该服务通常作为本地系统运行,它可能没有权限访问Word对象模型。此外,如果单词已经在使用一些其他用户的凭据运行,那么你的程序可能无法使用不同的凭据通过COM来访问它。在办公应用程序往往是单一实例,这似乎加剧了这一问题。

It definitely sounds like a permissions problem. Are you running your code in a windows service? The service normally runs as Local System, which may not have permission to access the Word object model. Additionally, if word is already running using the credentials of some other user then your program may not be able to access it via COM using different credentials. The office applications tend to be single instance which seems to exacerbate this problem.

这篇关于检索COM类工厂组件的错误而生成的Word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆