Retrieving COM Class Factory For Component Failed 800700c1

A customer had migrated from 32-bit Windows XP to 64-bit Windows 8 and many of their .NET apps failed to launch, with an error like below:

clip_image002

The registry key for HKCR\CLSID\<GUID> was present, and the relevant OCX/DLL had been registered and was present on the system.

When you see error 800700c1 typically the issue is you have a 64-bit EXE trying to load a 32-bit DLL, which is not possible in Windows.

This issue is typically unique to .NET applications that also load native DLLs, because they can be compiled to “ANY CPU”

We should check the .NET exe with with CorFlags ( http://msdn.microsoft.com/en-us/library/ms164699%28VS.80%29.aspx )

This tool is available from the Windows SDK in the .NET Development Tools subcomponent (Developer Tools -> Windows Development Tools -> .NET Development Tools)

clip_image002[5]

We can see with 32bitreq = 0, this is set to “ANY CPU” This means it will run as 64-bit EXE on Windows x64 and 32-bit EXE on 32-bit Windows. As a consequence

  • Any native DLLs it loads must be 64-bit
  • Any installer that installs reg keys must be marked as 64-bit so reg keys go to correct location

If the application needs/benefits from addressing more than 2GB of RAM then it may be best to leave it as “Any CPU” However then 64-bit versions of all DLLs it loads need to be installed/registered.

The easiest way to fix such an application is to change app to x86.

This can be done with compiler options in Visual Studio

clip_image001

Or the EXE can be modified using corflags.exe

For example:

corflags /32bit+ C:\source\wds\wds.exe

Now the EXE will run in 32-bit mode, even on x64 OS.

clip_image004

About chentiangemalc

specializes in end-user computing technologies. disclaimer 1) use at your own risk. test any solution in your environment. if you do not understand the impact/consequences of what you're doing please stop, and ask advice from somebody who does. 2) views are my own at the time of posting and do not necessarily represent my current view or the view of my employer and family members/relatives. 3) over the years Microsoft/Citrix/VMWare have given me a few free shirts, pens, paper notebooks/etc. despite these gifts i will try to remain unbiased.
This entry was posted in .NET and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s