web analytics

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

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.

CreatingApplication

 

 

 

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:

  1. Administrator
  2. System
  3. 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

  1. Go to Start -> Run.
  2. Type DCOMCNFG. (This will load the “Component Services”)
  3. Go to Component Services -> Computers -> My Computer -> DCOM Config -> Microsoft Excel Application.
  4. Right click and select Properties.
  5. Select the Security tab.

ExcelProperties

 

 

 

 

 

 

 

 

 

 

 

  • In “Launch and Activate Permissions” select Customize and press the Edit button.

LaunchPermission

 

 

 

 

 

 

 

 

 

 

Press Add button to select the “Network Service” account.

SelectUser

 

 

 

 

 

ShowPermissions

 

 

 

 

 

 

 

 

 

 

Click the OK button, and then test your application, it should work fine now.

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

  • November 9, 2009 at 1:36 am
    Permalink

    hmm, now i got it…. thanks for sharing.

  • January 2, 2010 at 3:52 am
    Permalink

    if microsoft office is not there in my system..then what to do.can you help me?

  • March 4, 2010 at 1:05 pm
    Permalink

    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??

  • April 21, 2010 at 12:08 am
    Permalink

    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

  • April 21, 2010 at 10:35 pm
    Permalink

    you have to use Admin Login for changing Excel properties.

  • Pingback:coder99 » Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.

  • September 9, 2010 at 5:01 am
    Permalink

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

    🙁

  • September 9, 2010 at 10:08 am
    Permalink

    Is Microsoft Office fully installed on your system?

  • November 18, 2010 at 6:22 am
    Permalink

    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.

  • December 29, 2010 at 1:49 pm
    Permalink

    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 !!!!

  • July 6, 2011 at 2:15 am
    Permalink

    Thks for ur help.. its working fine for me

  • October 25, 2011 at 5:48 am
    Permalink

    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

  • November 25, 2011 at 9:21 am
    Permalink

    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 🙂

  • April 12, 2012 at 2:15 am
    Permalink

    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

  • May 28, 2012 at 10:36 pm
    Permalink

    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.

  • June 11, 2012 at 12:15 am
    Permalink

    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.

  • June 28, 2012 at 3:59 am
    Permalink

    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.

  • Pingback:Retrieving the COM class factory for component with CLSID

  • October 11, 2012 at 2:45 am
    Permalink

    i have done all the steps u mentioned in Microsoft Excel Application property’s security tab. Still it’s not working. Pls help

  • January 1, 2013 at 10:47 pm
    Permalink

    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

  • May 22, 2013 at 7:53 am
    Permalink

    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

  • June 12, 2013 at 2:02 am
    Permalink

    Thanks, its works for me.

  • September 20, 2013 at 3:31 am
    Permalink

    gr8 man…thnks a lot

  • August 31, 2016 at 10:13 am
    Permalink

    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.

Leave a Reply

%d bloggers like this: