"检索COM类工厂组件....错误:80070005访问被拒绝" (异常来自HRESULT:0X80070005(E_ACCESSDENIED)) [英] "Retrieving the COM class factory for component.... error: 80070005 Access is denied." (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

查看:687
本文介绍了"检索COM类工厂组件....错误:80070005访问被拒绝" (异常来自HRESULT:0X80070005(E_ACCESSDENIED))的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚创建了一个简单的应用程序,并在 IIS6.0 举行。在code,我只是实例化Excel对象。

 使用Excel = Microsoft.Office.Interop.Excel.Application;命名空间TestHosting
{
    公共部分类WebForm1的:System.Web.UI.Page
    {
        保护无效的Page_Load(对象发件人,EventArgs的发送)
        {
            Excel中excelObj =新Microsoft.Office.Interop.Excel.Application();
        }
    }
}

它给我下面的错误

 检索COM类工厂CLSID为{00024500-0000-0000-C000-000000000046}失败,原因是以下错误组件:80070005访问被拒绝 (异常来自HRESULT:0X80070005(E_ACCESSDENIED))。

系统配置:

的Windows Server 2008企业版64位。
服务包2

我试着用因特网上发现许多可能的解决方案,但没有人对我进行了合作。

有些解决方案我试过低于

1)路径下创建桌面应用程序C:\\ WINDOWS \\ Syswow64资料\\设置\\ systemprofile
2)DCOMCNFG设置完全权限/控制Microsfot.EXcelApplicaiton
3)杀死所有的Excel实例在任务管理器

请帮我在这方面,这只是示例应用程序,但在我原来的应用主要是关于读取和写入数据从/到Excel。


解决方案

  1. 请确保您在服务器上安装的Office运行时。

  2. 如果您使用的是Windows Server 2008中,然后使用办公室互操作性展示是一个lenghty配置和这里的步骤。

更好的是将打开XML或者可以配置如下


  • 安装MS Office Pro的最新版本(我用2010专业版)

  • 创建用户ExcelUser。具有管理员组
  • 分配WordUser
  • 转到电脑 - >管理

  • 添加用户下面选项

  • 用户选项密码永不过期

  • 密码不能修改

COM +配置


  • 进入控制面板 - >管理 - >组件服务 - > DCOM配置

  • 打开Microsoft Word 97 - 2003属性

  • 常规 - >身份验证级别:无

  • 安全 - >自定义所有3权限,让大家

  • 标识 - >这个用户 - >使用ExcelUser /密码

  • 启动Excel的应用程序,以确保一切都很好

3.Change Microsoft Excel应用程序在DCOM配置的安全设置。

控制面板 - >管理工具 - >组件服务 - >计算机 - >我的电脑 - > DCOM配置 - > Microsoft Excel应用程序

单击鼠标右键获得属性对话框。转到安全选项卡和自定义权限

在这里看到的帖子:<一href=\"http://social.msdn.microsoft.com/Forums/en-US/b6388275-b295-4e55-8c25-6d8788eac1ca/error-while-creating-excel-object\">Error在创建Excel对象,<一个href=\"http://social.msdn.microsoft.com/Forums/vstudio/en-US/1d5f1c83-10a7-4322-80a9-0a4348c738c9/excel-manipulations-in-wcf-using-com\">Excel使用WCF操作COM

I just created a simple application and hosted in IIS6.0. In code I'm just instantiating excel objects.

using excel = Microsoft.Office.Interop.Excel.Application;

namespace TestHosting
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            excel excelObj=new Microsoft.Office.Interop.Excel.Application();
        }
    }
}

Its giving me following error

 "Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied." (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

System Configuration:

Windows server 2008,enterprise edition with 64 bit. service pack 2

I tried with many possible solutions found on internet,but none of them were worked for me.

Some solution I tried are below

1) creating Desktop application under the path "C:\Windows\SysWOW64\config\systemprofile" 2)setting full permission/control for Microsfot.EXcelApplicaiton in DCOMCNFG 3)Killing all excel instances in Task Manager

Please help me in this regard,this is just sample app but in my original app is mostly about read and writing data from/to excel.

解决方案

  1. Make sure that you have Office runtime installed on the server.
  2. If you are using Windows Server 2008 then using office interops is a lenghty configuration and here are the steps.

Better is to move to Open XML or you can configure as below

  • Install MS Office Pro Latest (I used 2010 Pro)
  • Create User ExcelUser. Assign WordUser with Admin Group
  • Go to Computer -> Manage
  • Add User with below options
  • User Options Password Never Expires
  • Password Cannot Be Change

Com+ Configuration

  • Go to Control Panel - > Administrator -> Component Services -> DCOM Config
  • Open Microsoft Word 97 - 2003 Properties
  • General -> Authentication Level : None
  • Security -> Customize all 3 permissions to allow everyone
  • Identity -> This User -> Use ExcelUser /password
  • Launch the Excel App to make sure everything is fine

3.Change the security settings of Microsoft Excel Application in DCOM Config.

Controlpanel --> Administrative tools-->Component Services -->computers --> myComputer -->DCOM Config --> Microsoft Excel Application.

Right click to get properties dialog. Go to Security tab and customize permissions

See the posts here: Error while creating Excel object , Excel manipulations in WCF using COM

这篇关于&QUOT;检索COM类工厂组件....错误:80070005访问被拒绝&QUOT; (异常来自HRESULT:0X80070005(E_ACCESSDENIED))的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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