COM class factory error
I am getting the following error on my workstation when I am trying to work with a COM object.
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in CarteGraphInterface.exe
Additional information: Retrieving the COM class factory for component with CLS开发者_Go百科ID {3963F0F8-6B0C-4A65-90F4-F60168044014} failed due to the following error: 80040154.
I have read through a few questions here on SO and non of them have helped. That ID is not listed anywhere in the registry. Does it need to be added?
Update: A bit more information. When I choose "Add Reference..." in VS2008, the object is listed there (that is how I found it initially), and the source is listed as a *.exe. regsrv32 didn't work.
It might be that you need to register the COM DLL using
regsvr32.exe /i dllname
Try that first perhaps and see if that makes a difference.
EDIT: Don't know if you use this, but COM Explorer might be able to help you too. Try the trial version to if it helps you with this problem.
EDIT: I've been trying to find out more about the error code, and the best I could find is this, which clarifies that it must be the DLL which is not registered.
How did you add reference to your project? When working with COM you almost always should add reference at "COM" tab (not at "Browse"), this ensures you will get a valid reference to a registered object, creating a new interop assembly. Though, if you have a registration problem, you most probably won't find required reference on COM tab.
First, it's very strange for a COM component to live in an executable file (though it's possible). Maybe this component wasn't supposed to be instantiated from another application, so all registration data had been removed? I would suggest contacting whomever you got this component from and ask for a registerable dll version.
None of these solutions worked. I assume that they do not actually have APIs that could be used with .NET (if at all).
精彩评论