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

.NET, ASP.NET | Nauman | November 3, 2009 at 8:59 am

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.

    Tags: , , , , , , , , , ,

    6 Comments

    1. Oes Tsetnoc Punk Poser says:

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

    2. Suneetha says:

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

    3. abid says:

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

    4. muthuraj.net@gmail.com says:

      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

    5. Nauman says:

      you have to use Admin Login for changing Excel properties.

    Leave a Reply