Click here to Skip to main content
15,916,463 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I am creating excel running fine on my local machine & its not running on remote server. its works fine on existing server (10.254.544.88). but when i deploy application on new server (10.254.544.125) throw error.

I am using -:

Microsoft.Office.Interop.Excel 14.0
Asp.net 3.5 framework
Window Sever 2008
IIS 7.5
Microsoft office 2007 Installed on server


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

Please help & What is issue
Posted
Updated 1-Jun-16 23:46pm

Hi,

Always using the COM will be an issue (The accessing of the COM will vary from one machine to another). I also faced the same issue. So I have used OLEDB to create the excel.

I have created a template file (which format you want to download)

string strChgFileName = "OUT" + System.DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xls";
string strWebServerSavePath = GetRefCodeValue(FileUpDownPath, "1") + "\\";
string strTemplatePath = GetRefCodeValue(FileTemplatePath, "1") + "\\";
File.Copy(strTemplatePath + "Template.xls", strWebServerSavePath + strChgFileName);
strWebServerSavePath += strChgFileName;

string strConString = "Provider=Microsoft.Jet.OLEDB.4.0;" +

"Data Source=" + strWebServerSavePath + ";" +

"Extended Properties=\"Excel 8.0;HDR=YES\"";

OleDbConnection con = new OleDbConnection(strConString);
con.Open();
try
{
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = con;
int rowCount = 1;

StringBuilder sbInserts;
StringBuilder sbColValues;

//CRAETE TABLE
sbInserts = new StringBuilder();
for (int i = 1; i <= dtVIN.Columns.Count; i++)
{
if (sbInserts.Length == 0)
{
sbInserts.Append("[" + dtVIN.Columns[i - 1].ColumnName + "]");
}
else
{
sbInserts.Append(", [" + dtVIN.Columns[i - 1].ColumnName + "]");
}
}

foreach (DataRow dr in dtVIN.Rows)
{
sbColValues = new StringBuilder();
rowCount += 1;
for (int i = 1; i < dtVIN.Columns.Count + 1; i++)
{
if (sbColValues.Length == 0)
sbColValues.Append("'" + dr[i - 1].ToString() + "'");
else
sbColValues.Append(", '" + dr[i - 1].ToString() + "'");
}

cmd.CommandText = String.Format("INSERT INTO [kn01u0$]({0}) VALUES({1})", sbInserts.ToString(), sbColValues.ToString());
cmd.ExecuteNonQuery();

}
con.Close();
 
Share this answer
 
Check this link in CP, it talks about word file, same might help for excel as well.
Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040005[^]
 
Share this answer
 
I solved this issue.

System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC

at Microsoft.Office.Interop.Excel.WorkbookClass.SaveAs(Object Filename, Object FileFormat, Object Password, Object WriteResPassword, Object ReadOnlyRecommended, Object CreateBackup, XlSaveAsAccessMode AccessMode, Object ConflictResolution, Object AddToMru, Object TextCodepage, Object TextVisualLayout, Object Local)

Officially Microsoft Office 2003 Interop is not supported on Windows server 2008 by Microsoft.

But after a lot of permutations & combinations with the code and search, we came across one solution which works for our scenario.

The solution is to plug the difference between the way Windows 2003 and 2008 maintains its folder structure, because Office Interop depends on the desktop folder for file open/save intermediately. The 2003 system houses the desktop folder under systemprofile which is absent in 2008.

So when we create this folder on 2008 under the respective hierarchy as indicated below; the office Interop is able to save the file as required. This Desktop folder is required to be created under

C:\Windows\System32\config\systemprofile

AND

C:\Windows\SysWOW64\config\systemprofile

Also do check if .NET 1.1 is installed because its needed by Interop and ot preinstalled by Windows Server 2008

Or you can also Use SaveCopyas() method ist just take onargument as filename string)

Follow the Below steps:

Setp 1 :

On Web.config File Add the below in <system.web>Tag

<identity impersonate="true">

userName="domain\username"

password="userpassword"/>

UserName : Login Id who loged on the Machine(or server)

Password : Password who loged on the machine(or server)

Setp 2:

1. Go to Start->Run

2. Type “DCOMCNFG”

3. Open Console Root->Component Service->Computer->My Computer->DCOM Config

4. Right Click Property on “Microsoft Excel Application”

5. Go to Identity Tab

6. Select “This User”

a. User : Logged User Name

b. Password : Logged user Password
 
Share this answer
 
Comments
Real Hasnain 30-Apr-17 2:19am    
i got my solution ..... thanks from bottom of my heart ......
Issue Resolved:

I had written a .net code which was reading outlook mails on local machine. The code used to work fine with Outlook 2010. But I was getting below error when I have upgraded my Outlook version from 2010 to 2013(64 bit).

Issue got resolved after I have installed 32 bit version of Outlook 2013 on my system.

Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80004023 A Microsoft Software Installer error was encountered. (Exception from HRESULT: 0x80004023).
 
Share this answer
 
Comments
CHill60 2-Jun-16 6:55am    
We know that the OP solved their problem - they posted Solution 3 over 3 years ago saying that it was fixed

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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