通过 asp.net 访问 Office Word 对象模型会导致“由于以下错误而失败:80070005 访问被拒绝". [英] Accessing Office Word object model through asp.net results in "failed due to the following error: 80070005 Access is denied."

查看:18
本文介绍了通过 asp.net 访问 Office Word 对象模型会导致“由于以下错误而失败:80070005 访问被拒绝".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个网站,允许用户上传办公文档,然后使用办公对象模型将文档转换为 HTML 文件,然后在 iFrame 中显示.

I have developed a website that allows users to upload office documents then uses the office object model to convert the document to an HTML file that it then displays in an iFrame.

当然,我已经包含了对 Office.interop.word 的引用,并且该站点在我的开发机器上运行良好.当我将它上传到我的生产服务器时,站点运行良好,直到我尝试上传文档.我最初收到一个类似的错误,提示COM 对象未注册".我意识到我的生产服务器上没有安装 Word.所以我安装了 word,现在 当服务器尝试访问 word 对象模型时,我收到以下错误:

I have, of course, included references to Office.interop.word, and the site works fine on my development machine. When I uploaded it to my production server the site functions fine until I try to upload a document. I initially got a similar error that said "COM object not registered". I realized that Word wasn't installed on my production server. So I installed word and now when the server tries to access the word object model I receive the following error:

由于以下错误,检索具有 CLSID {000209FF-0000-0000-C000-000000000046} 的组件的 COM 类工厂失败:80070005 访问被拒绝.(来自 HRESULT 的异常:0x80070005 (E_ACCESSDENIED))

我在注册表中搜索了相应的 CLSID,并找到了相应的文件夹.我向 IUSR_ 帐户添加了完全控制权,由于错误的持续存在,我最终向所有人"添加了完全控制权,并确保将这些权限继承到文件夹的其余部分.然后,我向 IUSR_ 添加了完全控制权,并最终再次向我的 microsoft office 文件夹中的所有人"添加了完全控制权.

I searched the registry for the corresponding CLSID and found a corresponding folder. I added full control to the IUSR_ account and due to the persistence of the error I eventually added full control to "everyone" and ensured these permissions inherited down to the rest of the folder. I then added full control to IUSR_ and again eventually added full control to "everyone" to my microsoft office folder.

不知道要授予哪些其他权限以及在哪里才能消除此访问被拒绝"错误.我必须在错误的地方授予它们,因为就我知道我不能比每个人"完全控制"更宽容.

I don't know what other permissions to grant and where in order to make this "Access is denied" error go away. I must be granting them in the wrong place, because as far as I know I can't be any more permissive than "Everyone" "Full Control".

任何人都可以解释一下吗?

Can anyone shed any light?

推荐答案

这对我有用:

  1. 在命令行中输入 DCOMCNFG
  2. 组件服务 -> 计算机 -> 我的电脑 -> DCOM 配置
  3. 查找Microsoft Word 97 - 2003 文档"(如果它没有运行,请检查您的 Word 是否也是 64 位的(如果您的 Windows 是)mmc comexp.msc/32而不是 Darkseal 这里)
  4. 右键单击 -> 属性
  5. 转到选项卡安全性并编辑自定义"单选按钮,以便 IIS_IUSRS 可以拥有启动和访问权限
  6. 转到 Tab Identity 并选择交互式用户"
  7. 应用更改并重试
  8. 如果这一切都失败了,也请转到常规"选项卡,然后在身份验证级别"下拉菜单中选择无".
  1. In the command line put DCOMCNFG
  2. Component Services -> Computers -> My Computer -> DCOM Config
  3. Find "Microsoft Word 97 - 2003 Document" (If it is missing check if your Word is also 64 bit (if your Windows is) if it is not run mmc comexp.msc /32 instead of DCOMCNFG on step 1 as suggested by Darkseal here)
  4. Right click -> Properties
  5. Go To Tab Security and Edit the "Customize" radio buttons so that IIS_IUSRS could have rights for launch and access
  6. Go to Tab Identity and choose "The interactive user"
  7. Apply changes and try again
  8. If all this fails, go also to tab "General" and in "Authentication Level" drop down choose "None".

这篇关于通过 asp.net 访问 Office Word 对象模型会导致“由于以下错误而失败:80070005 访问被拒绝".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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