Freigeben über


Failed --Retrieving the COM class factory for component with CLSID ....

PROBLEM:

When you run the .net Code in X64 Environment you will get the following error message.

" Failed --Retrieving the COM class factory for component with CLSID ...."

E.g. in CMS Export / Import server side .net code = "ExportSiteContentIncremental(...) Failed --Retrieving the COM class factory for component with CLSID {CA0752B3-021C-4F99-82E3-2C0F19C5E953} failed due to the following error: 80040154."

WORKAROUND:

The possible workaround is modify your project's platform from 'Any CPU' to 'X86' (in Project's Properties, Build/Platform's Target)

ROOTCAUSE

The VSS Interop is a managed assembly using 32-bit Framework and the dll contains a 32-bit COM object. If you run this COM dll in 64 bit environment, you will get the error message.

Comments

  • Anonymous
    December 09, 2006
    L'altro giorno ho pagato le spese di un problema legato all'istanziazione di componenti COM, via COM-Interop,...

  • Anonymous
    March 01, 2007
    The comment has been removed

  • Anonymous
    August 06, 2007
    Hi is there any way to call the COM object therough some other method?

  • Anonymous
    March 08, 2008
    PingBack from http://zayz.wordpress.com/2008/03/08/net-well-com-this/

  • Anonymous
    June 11, 2008
    PingBack from http://www.newcodingjobs.com/c/fix-error-retrieving-the-com-class-factory.htm

  • Anonymous
    June 11, 2008
    PingBack from http://www.newcodingjobs.com/c/fix-error-retrieving-the-com-class-factory-2.htm

  • Anonymous
    July 21, 2009
    Thanks Karthi. This article helped me. I was running behind this problem for about a week. Is there a way this can be applied on ASP.Net application? I get the following error when I target it for x86 and use in ASP.net System.BadImageFormatException: Could not load file or assembly 'MyClassLibrary' or one of its dependencies. An attempt was made to load a program with an incorrect format. WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLMSoftwareMicrosoftFusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLMSoftwareMicrosoftFusion!EnableLog].

  • Anonymous
    April 10, 2012
    Thanks I had the same error when trying to communicate with an agilent 34980A DMM instrument and I could not figure out why the sample code using VISA (text string based) interface worked and the Interop interface did not. Sure enough Any CPU changed to X86 did the trick. Thanks a bundle...

  • Anonymous
    April 12, 2012
    I'm having the same issue now, but all my target builds are already set to x86. Its a Visual Studio 2010 winforms app which uses a third party dll. This dll has been added to the setup as an assembly and I've tried both "vsdraCOMRelativePath" and "vsdraDoNotRegister" with no luck, but I may be barking up the wrong tree!

  • Anonymous
    June 03, 2012
    The Solution from this site worked... aspdotnet.hotinit.com/.../retrieving-com-class-factory-for.html

  • Anonymous
    June 06, 2013
    Thanks for the info. Was struggling on this for many days

  • Anonymous
    September 05, 2014
    The comment has been removed

  • Anonymous
    July 29, 2015
    Excellent! Our dev had been struggling with this for months