Click here to Skip to main content
15,884,876 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Comments
Maciej Los 14-Jul-14 2:02am    
We need to see the code in which error occurred.

1 solution

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
 
Share this answer
 
Comments
nilesh sawardekar 14-Jul-14 2:26am    
is this solve your problem...please reply us..for better answer..
mvengaqua 14-Jul-14 4:10am    
i have windows 2012 server and office 2007. please tell me for this

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900