导出到excel给出错误 [英] Export to excel giving error

查看:241
本文介绍了导出到excel给出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我在excel中导出报告时遇到错误。我有一个Windows Server 2012,IIS 8.0和SQL Server 2012.



当我在本地运行时,代码运行正常。但是只要我在IIS上托管它就会出错。



错误是:



'/'应用程序中的服务器错误。



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



描述:在执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。



异常详细信息:System.UnauthorizedAccessException:由于以下错误,检索CLSID为{00024500-0000-0000-C000-000000000046}的组件的COM类工厂失败: 80070005访问被拒绝。 (来自HRESULT的异常:0x80070005(E_ACCESSDENIED))。





请帮我解决问题。



问候,

venga

解决方案

确保在服务器上安装了Office运行时。

如果你是使用Windows Server 2008,然后使用办公室互操作是一个长期配置,这是步骤。

更好的是转移到Open XML或你可以配置如下



安装MS Office Pro最新版本

创建用户ExcelUser。使用管理员组分配WordUser

转到计算机 - >管理

添加以下选项的用户

用户选项密码永不过期

密码无法更改

Com + Configuration < br $> b $ b

转到控制面板 - >管理员 - >组件服务 - > DCOM配置

打开Microsoft Word 97 - 2003属性

一般 - >身份验证级别:无

安全性 - >自定义所有3个权限以允许每个人

身份 - >此用户 - >使用ExcelUser /密码

启动Excel应用程序以确保一切正常

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



Controlpanel - >管理工具 - >组件服务 - >计算机 - > myComputer - > DCOM配置 - > Microsoft Excel应用程序。



右键单击以获取属性对话框。转到安全选项卡并自定义权限



请参阅此处的帖子:创建Excel对象时出错,使用COM在WCF中进行Excel操作

Dear all,

I am getting error while exporting the report in excel. i have a windows server 2012, with IIS 8.0 and SQL server 2012.

The code runs fine when i run locally. But as soon as i host it on the IIS it give error.

The Error is:

Server Error in '/' Application.

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)).

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.

Exception Details: System.UnauthorizedAccessException: 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)).


Please help me out in resolving the issue.

Regards,
venga

解决方案

Make sure that you have Office runtime installed on the server.
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
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


这篇关于导出到excel给出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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