The Crazy 80040154 COM Class Factory Error

GoingCrazy I have been working on a project recently which requires me to integrate with QuickBooks Online, in this case from a web application.  I have had the pleasure (strong word) working with integrating with QuickBooks in various capacities in the past and although it is not trivial, it does work.  I ran into an interesting problem recently with an error that baffled me.

While attempting to connect to QuickBooks online from my ASP.NET C# application, I received the following COM Exception:

Retrieving the COM class factory for component with CLSID {3C801F08-CDC5-4129-AAE8-CCC4F116B5BE} failed due to the following error: 80040154.

Searching the various Intuit Developer Forums led me nowhere.  I was thinking it may be the fact I am funning on Windows 7 and figured it might be an incompatibility with Windows 7 and the COM components from Intuit in their QuickBooks SDK.  After various Google searches I picked up a few clues to the source of the problem, which in hindsight should have been a bit more obvious to me.

64-Bit Friend and Foe

The root of the problem was not really Windows 7 but the fact I am running 64-bit and Visual Studio 2008 defaults the Platform Target to “Any CPU” when building a project.  So selecting Project-> {project name} Properties show the following dialog with Any CPU selected:

ProjectBuildProperties

By changing the choice of the Platform Target to x86 and rerunning my application, the creation of the session to QuickBooks Online works fine.  The idea should have probably been more obvious to me, knowing the DLL’s from Intuit are 32-bit COM-based and the interop to my 64-bit operating system could cause some problems.

If anyone wants to add the technical details as to why this behaves as it does, I will update this post with those technical details.  I hope this helps someone else with the same problem so they won’t waste the time that I did.

  • Luis Alejandro

    Thank you very much!!!!.
    I just have the same environment and problem, jejeje, and thanks to this page I can see the sky now.
    Thank you, thank you very much!!!

  • Luis Alejandro

    Thank you very much!!!!.

    I just have the same environment and problem, jejeje, and thanks to this page I can see the sky now.

    Thank you, thank you very much!!!

  • David Spink

    Thanks for this explanation – it took me alot of digging around to even discover the nature of the problem (32bit vs 64bit) – and I thought it was going to take just as long to find a way to solve it until I found this page!

  • David Spink

    Thanks for this explanation – it took me alot of digging around to even discover the nature of the problem (32bit vs 64bit) – and I thought it was going to take just as long to find a way to solve it until I found this page!

  • Jim Twitchell

    Thanks so much for this – was looking at this problem for a few hours and had just about run out of ideas…

  • Jim Twitchell

    Thanks so much for this – was looking at this problem for a few hours and had just about run out of ideas…

  • Albeb J

    thx very much , it’s let me crazy long time XD

  • Albeb J

    thx very much , it’s let me crazy long time XD

  • BobF

    I have the same problem, but I don’t appear to have the option to select x86 — only "Any CPU" appears in the configuration manager. Any ideas?

  • BobF

    I have the same problem, but I don’t appear to have the option to select x86 — only "Any CPU" appears in the configuration manager. Any ideas?

  • TillmanZ

    Thanks a lot!
    Had the same issue and fortunately your blog came up in google!

  • TillmanZ

    Thanks a lot!

    Had the same issue and fortunately your blog came up in google!

  • Al

    Thats great. Really helped me out!!!!

  • Al

    Thats great. Really helped me out!!!!

  • Oz

    Thanks a lot!!

  • Oz

    Thanks a lot!!

  • http://www.sysgbs.com/ Mike Satkevich

    BobF, in Visual Studio 2008, I had to click the Advanced Compile Options button at the bottom of the complile tab.
    Hope that helps…

  • http://www.sysgbs.com Mike Satkevich

    BobF, in Visual Studio 2008, I had to click the Advanced Compile Options button at the bottom of the complile tab.

    Hope that helps…

  • http://www.jdgonzalez.net/ J.D. Gonzalez

    Thanks so much for posting this. I must have spent hours trying to find out why I was getting the error.

  • http://www.jdgonzalez.net J.D. Gonzalez

    Thanks so much for posting this. I must have spent hours trying to find out why I was getting the error.

  • http://jdgonzalez.net/blog/2010/5/5/deploying-application-on-a-x64-server-com-class-factory-erro.html Deploying application on a x64 server (COM Class Factory Error)

    RE: The Crazy 80040154 COM Class Factory Error

    Like the Accidental Technologist , I too was working on a project that required me to write a custom application to loop through address and send the …

  • http://jdgonzalez.net/blog/2010/5/5/deploying-application-on-a-x64-server-com-class-factory-erro.html Deploying application on a x64

    RE: The Crazy 80040154 COM Class Factory Error

    Like the Accidental Technologist , I too was working on a project that required me to write a custom application to loop through address and send the …

  • Michelle

    YES! Thank you so much. 'Advanced compile options' and change Target CPU to x86. Not intuitive for deployment to 64-bit system. But it works!

  • Cbekir

    thanks a lot. i have spent a day to solve it