0
votes

I wasn't getting this error before on localhost, but now it's occurring when I uploaded my ASP.NET C# web app to the server. I've been looking for an answer how to fix this, but cannot seem to get rid of it. I have a Microsoft.Office.Interop.Excel DLL which I am trying to use to export data from a dataset to excel. I was told by customer service that the domain that I have registered is hosted on a 32-bit server. Please help!

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

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.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154.

Source Error:

Line 499:            object misValue = System.Reflection.Missing.Value;
Line 500:
Line 501:            xlApp = new Excel.ApplicationClass();
Line 502:            xlWorkBook = xlApp.Workbooks.Add(misValue);
Line 503:            xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
3

3 Answers

1
votes

Look at http://support.microsoft.com/kb/897646
Article ID: 897646 - Last Review: January 5, 2006 - Revision: 1.10
Office 2003 Update: Redistributable Primary Interop Assemblies is available for download
Step 1.- Install Office 2003
Step 2.- Install SP Office
Step 3.- Install O2003PIA components

0
votes

There a guy describing step by step how to solve you problem here

0
votes

If the other solution doesn't work try adding the following to the web.config after

<identity impersonate="true" userName="******" password="*******"/>

Replacing the * with a valid Windows username and password that would have access to Excel. Make sure you login as the identity you are impersonating so you can verify that it has access to Excel (Office 2010 tends to want to reactivate Office for each user I've noticed).