Tuesday, September 27, 2011

Retrieving the COM class factory for component failed due to the following error: 80040154

Despite the fact that COM Components are considered legacy technology now, because Microsoft never made a clear cut decision to retire COM Components in newer versions of their Operating System these Libraries still linger around in many Applications, and have made their way into many .NET based Applications through DLL Referencing. Here is an error I have come across from time to time that doesn't tell you a whole lot unfortunately:

Retrieving the COM class factory for component with CLSID {XXXXXXXX-XX...} failed due to the following error: 80040154

There are several ways to resolve this issue. Here is a short list:

  1. Modify your project's platform from 'Any CPU' to 'X86' in Project Properties, Build/Platform's Target in Visual Studio
  2. If your Application is a Web-Based Application, try setting IIS to run in 32-bit mode. You can do this by going to IIS Manager, selecting the Application Pool, then choosing "Advanced Settings". The second option from the top is "Enable 32-bit Applications".
  3. If your Application is Web-Based, it could be that the com object was not configured to allow launch and access permissions for the aspnet user identity. Under administrative tools > Component services under the tree view, go to Component Services > Computers > My Computer > DCOM Config and find the registered com object. Right click for properties. Under the security tag, customize the Permissions to allow asp.net user
Usually one of the above 3 methods solves this problem.


Pete Soheil
DigiOz Multimedia
www.digioz.com




2 comments:

Unknown said...

I cant see "Enable 32-bit Applications" in iis. Can u check below post please.
http://www.codeproject.com/Questions/608042/PrivilegesplusinstantiateplusforplusOutlookplusCOM

DigiOz Multimedia said...

Hello Manu,

Your error is a different error. Take a look at this link: http://bit.ly/17U5509