issues w/ COM objects, .NET 2.0

C

campkd

I have run into some issues with COM objects in an application I am
working on, and am hoping for some help. The app I am working on is in
..NET 2.0, and I am trying to use a COM object written in FoxPro, which
will perform operations & write the transaction to a SQL database.
(Yes, i realize this is the most backward, fubar method ever, but it is
out of my hands)

On my development machine, the communication is established and the
entire app works great w/o any hitches whatsoever. Moving it to any
other machine creates major issues.

I am getting two main errors - on some machines, i get the following

System.Runtime.InteropServices.COMException (0x80040154): Retrieving
the COM class factory for component with CLSID
{B08DD0B3-2DA9-43D9-9E4F-831A96DFEC63} failed due to the following
error: 80040154.

On others, it makes it past retrieving the COM object, but then fails
with the following -

System.InvalidCastException: Unable to cast COM object of type 'X' to
interface type 'Y'. This operation failed because the QueryInterface
call on the COM component for the interface with IID
'{2B2189C1-D464-4E98-A3C1-EC9D5F897768}' failed due to the following
error: Bad variable type. (Exception from HRESULT: 0x80020008
(DISP_E_BADVARTYPE)).
From what I have read, the 80040154 error indicates registration issues
and/or permission issues - the interop assy, as output by VS2005 won't
permit registration using Regsvr32, and the machine is logged in as
Admin, so permissions shouldn't be an issue. I have since strong-named
the output of the project and been able to place the Interop.xxx.dll
ass'y in the GAC, but it still throws the Invalid Cast exception.

So.... I can't think of much more to try, especially since it works
fine in the development environment. Any suggestions would be greatly
appreciated. Thanks!
 
D

Dave Sexton

Hi,

It sounds to me like the COM registration is invalid or nonexistant. Doesn't seem like a .NET problem at all, but I could be wrong.
Make sure you register the COM dlls on the client machines (the interop assemblies are not enough). Make sure the development
versions and the deployed versions of the COM dlls are identical as well.

Regsvr32 registers COM dlls, not managed assemblies. Your interop assemblies require the COM components to be registered.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top