Sometimes when working with office Interop assemblies the above mentioned error occurs. I had also got the same when using Microsoft Excel interop assembly and adding its reference in my ASP.NET application.
The problem is that by default when Microsoft Excel is used as a COM object then it can only be activated by the following accounts:
- Administrator
- System
- Interactive
And when you are running your web application on windows server 2003, it is running under ASPNET account.
The way to resolve this issue is to edit the DCOM configuration settings for Microsoft Excel Application object.
Configure DCOM
- Go to Start -> Run.
- Type DCOMCNFG. (This will load the “Component Services”)
- Go to Component Services -> Computers -> My Computer -> DCOM Config -> Microsoft Excel Application.
- Right click and select Properties.
- Select the Security tab.
- In “Launch and Activate Permissions” select Customize and press the Edit button.
Press Add button to select the “Network Service” account.
Click the OK button, and then test your application, it should work fine now.
#.NET
#asp.net
#class factory
#dcom
#error
#excel
#excel application
#interop
#Microsoft
#network service
#Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error 80040154
#workbook
Related posts
25 Comments
Leave a Reply Cancel reply
Recent Posts: TechnoBlogy
The Best Surveillance Cameras in 2018

Intel: Virus Scanners Should Use the Performance of the GPU

Azure Sphere: Microsoft uses Linux instead of Windows for the IoT

Microsoft relies on its own chips for IoT security – and Linux

Bitcoin mining through a hydraulic turbine – Dubbed Ocean Miner

Sony Xperia XZ2 Premium, with dual photo sensor and 4K HDR screen!

Microsoft Introduces Azure Sphere Hardware and Software Platform

Behind the Recent Russian Cyber Attack

What is the GDPR? The 7 most Important Questions and Answers

Hyperloop TT begins to build its test track in Toulouse

hmm, now i got it…. thanks for sharing.
if microsoft office is not there in my system..then what to do.can you help me?
some guys said to use 32 bit OS, im using . And im not using this excel object. im using vendors dll meant for vb.net wch I converted using tlbimp to be used in my c# code and now getting the error com class factory ….. any idea to workaround??
hi i done all those things which mentioned above but i cant find solution. still i am getting this error.
My doubt is whether there’s relation between administrator Login or Ordinary user Login
you have to use Admin Login for changing Excel properties.
[…] Solution : http://159.89.228.174/retrieving-the-com-class-factory-for-component-with-clsid-00024500-0000-0000-… […]
i am not getting the “Microsoft Excel Application” in the list of Components under the hierarchy….what could be the issue?
Please help me out….
🙁
Is Microsoft Office fully installed on your system?
private void button1_Click(object sender, EventArgs e)
{
// creating Excel Application
Microsoft.Office.Interop.Excel._Application app = new Microsoft.Office.Interop.Excel.Application();
// creating new WorkBook within Excel application
Microsoft.Office.Interop.Excel._Workbook workbook = app.Workbooks.Add(Type.Missing);
// creating new Excelsheet in workbook
Microsoft.Office.Interop.Excel._Worksheet worksheet = null;
// see the excel sheet behind the program
app.Visible = true;
// get the reference of first sheet. By default its name is Sheet1.
// store its reference to worksheet
worksheet =(_Worksheet) workbook.Sheets[“Sheet1”];
worksheet = (_Worksheet)workbook.ActiveSheet;
// changing the name of active sheet
worksheet.Name = “Exported from gridview”;
// storing header part in Excel
for (int i = 1; i < dataGridView1.Columns.Count + 1; i++)
{
worksheet.Cells[1, i] = dataGridView1.Columns[i – 1].HeaderText;
}
// storing Each row and column value to excel sheet
for (int i = 0; i < dataGridView1.Rows.Count – 1; i++)
{
for (int j = 0; j < dataGridView1.Columns.Count; j++)
{
worksheet.Cells[i + 2, j + 1] = dataGridView1.Rows[i].Cells[j].Value.ToString();
}
}
// storing Each row and column value to excel sheet
for (int i = 0; i < dataGridView1.Rows.Count – 1; i++)
{
for (int j = 0; j Microsoft.Office.Interop.Excel._Application app = new
Microsoft.Office.Interop.Excel.Application(); it show error
can any help to get data in gridview and then it posted in excel sheet using windows application and c#.net.
Hello how are you, I did the process to run application on the server, but the truth does not work for me now I is generating another error when trying to open the file, the error is as follows “Error in remote procedure call. (Exception from HRESULT: 0x800706BE) “could help me I would appreciate
Thanks !!!!
Thks for ur help.. its working fine for me
Do we need to have excel already installed on the Windows Server 2003 machine.
-Rajeev
http://magazineforipad.com
I had the same problem running C# code with reference to a COM dll.
Changing platform from AnyCPU to x86 didn’t help.
Changing the reference property “Isolated” to True inside the C# project, solved the problem.
Also, all the files created by compilation should be copied together with exe:
*.exe.manifest
*.pdb
*.vshost.exe
Interop.*.dll
Was getting this error for a long time, resolved now 🙂
Thank you for clear instructions!
Also though you have tried to explain why this alert was occuring, however I still haven’t got it… my head needs more explanation 🙂
Hi,
I have configured as mentioned, but still problem is existing.
Is it mandatory to have excel installed,moment itsnt installed in the server.
pls advice
I have installed MS office 2010 using click-to-run.Getting error “Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154” while importing an excel in C#.Net application. It is installed virtually so Microsoft Excel Application is not listed under the components list in DCOMCNFG. Please provide some other solution to resolve the issue.
I have installed MS office 2010 using click-to-run.Getting error “Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154″ while importing an excel in C#.Net application. It is installed virtually so Microsoft Excel Application is not listed under the components list in DCOMCNFG. Please provide some other solution to resolve the issue.
No, I checked this properties on my server machine , I changed it as per your screen shot.
But problem not solved it gives me error on catch block as following.
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
[…] Retrieving the COM class factory for component with CLSID […]
i have done all the steps u mentioned in Microsoft Excel Application property’s security tab. Still it’s not working. Pls help
Hi,
I am developing an application which runs on MS Azure, so I cannot install Office/Visio over there.
Is there a way by which I can develop develop visio file creation code in asp.net using just visio interop dlls ? I am trying but not able to do it as of now.
Is there a solution available by which we can do visio related programming without having visio installed on the development machine or server, and just use the visio dlls?
Please help.
Thanks
Definitely believe that which you stated. Your favorite justification seemed to be on the web the easiest thing
to be aware of. I say to you, I definitely get annoyed while people consider worries that they just
do not know about. You managed to hit the nail upon the top as well as defined out the whole thing without having side
effect , people could take a signal. Will likely be back to get more.
Thanks
Thanks, its works for me.
gr8 man…thnks a lot
I knew after I joined that is was a good program,
but I also knew that at some point I was going to outgrow it and need something more advanced.
Then the App name, app publisher, keywords and description , his installs, rating and reviews become
very important factors that will influence if the app will be found.
There are no push button get rich quick programs out
there that work.