Retrieving the COM class factory for component with CLSID {} failed - c#

I'm getting this error when running a C# Windows Forms application:
Retrieving the COM class factory for component with CLSID {} failed
due to the following error: 80040154 Class not registered (Exception
from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
This is appearing in the IDE on 32-bit Windows XP. The COM component in question is a 3rd party dll which is definitely registered ok on the machine in question. My project is targetting x86 ok. I only seem to get the error when instantiating a particular class of the component, other classes that I use are working fine.
I've tried with the component just added directly as a reference and have also created an interop assembly and referenced that but get the same result. Have unregistered and reregistered the component using regsvr32 to no avail.
If I reference the same component in a VB6 application and instantiate the same class it works fine! I am thoroughly confused, can anyone offer any suggestions which might help me out?!
Thank you.

I got this working by changing the instantiating line from:
Component.MyObject test = new Component.MyObject();
to
Component.MyObject test;
Not sure at this stage why that should work but it does so I can carry on! I'm still instantiating the other classes used with the new keyword.

Related

Create an instance of a component with CLSID COM's {...} from IClassFactory failed due to the following error: 800a01ad

I have a classLibrary project written in c#.
I have an old dll (cares managing data in db) that my project reference to.
when I try to create object of class from that dll, I get error:
Create an instance of a component with CLSID COM's {...} from IClassFactory failed due to the following error: 800a01ad.
what I tried:
1. execute regsvr32 command from cmd - got success but it still does not work.
2. using regAsm command to register the dll - got success but it still does not work.
the target framework is framework 2.0.
The factory has problems to create the com object.
In most cases there are missing dll's, which need to be loaded when the object is created.
Is that COM server implemented in C# or is it a native COM server?
If it's dotnet, you can use fuslogvw for finding the missing assembly.
If not, take a dll dependency walker.

How to get AutoIt reference working in C#?

I'm pulling my hair out on this one...
I have a legacy application I built a few years ago that uses AutoItX - all working fine.
The time has come to try and update the app, so I've upgraded it to VS2012/.NET4 and I simply cannot get a reference to the AutoItX library to work.
I have installed the application, have registered the dll with regsvr32, tried every combination of property settings on the reference itself (Embed Interop Types / Isolated), but no joy.
The error I keep getting whenever I try and create an AutoItX3 object is:
Retrieving the COM class factory for component with CLSID
{1A671297-FA74-4422-80FA-6C5D8CE4DE04} failed due to the following
error: 80040154 Class not registered (Exception from HRESULT:
0x80040154 (REGDB_E_CLASSNOTREG)).
Is it an issue that I'm on a 64-bit machine? I'm not trying to use the 64-bit DLL version.
Okay the solution was:
Open up regedit*32 (c:\windows\syswow64\regedit)
Search for AutoItX in HKEY_CLASSES_ROOT\AppID
I found it in HKEY_CLASSES_ROOT\AppID{6E8109C4-F369-415D-AF9A-2AEEFF313234}
Create a blank REG_SZ (String) entry called DllSurrogate
For some reason, this completely solved the issue.
Reference: How to use a 32 bit COM object on Windows Server 2008 (works on 2008 R2 but non 2008)
Hainesy,
do you use a x64-Windows?
I had the same problem when I was starting to have a look at COM.
If so, you should try to register your class in HKEY_LOCAL_MACHINE\SOFTWARE\WoW6432Node\Classes...
Give it a try!
Greeting

Error retrieving COM class factory - Class not registered

I'm trying to use the Mailroom Toolkit from Satori to standardize addresses, but every time I try to instantiate an instance of ZIPAssembly, I get the following exception.
{Satori.MailRoomToolKit.US.USException (0x80040154 from
ZIPAssembly::.ctor): Retrieving the COM class factory for component
with CLSID {E1DD1DB5-CEAD-4C36-B2E1-EDEC0DA4C1AC} failed due to the
following error: 80040154 Class not registered (Exception from
HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). at
Satori.MailRoomToolKit.US.Interfaces.ZIPAssembly..ctor()
I've tried regsvr32, but I get the message The module "MRTKUSAssembly.dll" was loaded but the entry-point DllRegisterServer was not found.
I've also tried setting my project target to x86, but that doesn't do it either. Any other ideas? Similar posts have not helped.
Note that I'm running on a 64bit machine and have tried setting my project target to x86 running in the visual studio web server, and setting my project as AnyCPU and running under IIS.
It turns out in this case with the Mailroom Toolkit from Satori, you have to run an install locally before you can use the dll. Seems there are some underlying com components that the dll requires and those need to get installed/registered.
If you are sure that this is the assembly where class factory resides in it means that it's a .net assembly that needs registering as COM component. You should look into regasm.
If it does work in Visual Studio it could be that Visual Studio did this registration for you, but you'll have to do this yourself in your deploy environment.

HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

I am building a GIS Application but whenever I run the code it's giving me this error
System.Runtime.InteropServices.COMException was unhandled
Retrieving the COM class factory for component with CLSID {FBF5715D-A05D-11D4-A64C-0008C711C8C1} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
Also, in the Project Properties the Option for Register For COM Interop is disabled.
This could also be an issue of building the code using a 64 bit configuration. You can try to select x86 as the build platform which can solve this issue. To do this right-click the solution and select Configuration Manager From there you can change the Platform of the project using the 32-bit .dll to x86
Just looking at the message it sounds like one or more of the components that you reference, or one or more of their dependencies is not registered properly.
If you know which component it is you can use regsvr32.exe to register it, just open a command prompt, go to the directory where the component is and type regsvr32 filename.dll (assuming it's a dll), if it works, try to run the code again otherwise come back here with the error.
If you don't know which component it is, try re-installing/repairing the GIS software (I assume you've installed some GIS software that includes the component you're trying to use).

Interop.MSXML2 throwing exceptions because its not registered BUT IT WONT REGISTER!

Ok, this line of code:
XMLHTTP40 http = new XMLHTTP40();
Throws a System.Runtime.InteropServices.COMException and complains that:
Retrieving the COM class factory for component with CLSID {88D969C5-F192-11D4-A65F-0040963251E5} failed due to the following error: 80040154.
I have googled that and I guess the DLL needs to be registered because its a COM DLL. That's fine, but when I try to register it I get this error:
C:\some\directory\path\etc\Interop.MSXML2.dll was loaded, but the DllRegisterServer entry point was not found.This file can not be registered.
Apparently this is working on another guys box (he wrote the code, so yeah.. :P). This COM object does not show up in my list of available COM references so I just reference the DLL which is sitting in the bin\Debug directory of the project. When I add the reference to this DLL to my project, I get access to all of the symbols in VisualStudio. I'm wondering, is there something that I can install that would register the DLL and have it show up in my list of COM objects that I can reference? I installed what I thought was the MSXML 4.0 library but when I looked in the directory there wasn't anything in there.
Any ideas?
You need to actually have MSXML4 installed on your box for it to work. THe interop dll doesn't contain any runtime code it only helps .NET talk to MSXML4.
However why would you not use the System.Xml namespace instead of using a COM component?
You need to register (regsvr32) msxml4.dll, not the interop assembly. msxml4.dll is the COM server.

Categories

Resources