all groups > dotnet remoting > july 2005 >
You're in the

dotnet remoting

group:

Com object called locally works fine but fails when called from remote object


Com object called locally works fine but fails when called from remote object pwl NO[at]SPAM 4me.pl
7/26/2005 6:37:39 AM
dotnet remoting:
I have and object
public class RemoteConverter : MarshalByRefObject
which uses Com object develped in Delphi. I created a wrapper class for
object with tlbimp.
Wrapper class consists of
interface 'ImagePointConverterNET.IVisImageConverter'.
class 'ImagePointConverterNET.TVisImageConverterClass'

When i user RemoteConverter locally (siply create it ) everything is
just fine. It works.
When i Create RemoteConverter remotly using Remoting mechanisms i get
an exception.

Object can be created succesfully

ImagePointConverterNET.IVisImageConverter conv = new
ImagePointConverterNET.TVisImageConverterClass();

Problem is when i call one of the methods of IVisImageConverter. i get
an exception :
Unable to cast COM object of type
'ImagePointConverterNET.TVisImageConverterClass' to interface type
'ImagePointConverterNET.IVisImageConverter'. This operation failed
because the QueryInterface call on the COM component for the interface
with IID '{F516846E-A92D-46E8-BBCE-3E5778A7C20C}' failed with HRESULT:
0x80004002 (Taki interfejs nie jest obslugiwany. (Exception from
HRESULT: 0x80004002 (E_NOINTERFACE))).


I dont undestand it because everything is ok when i use RemoteConverter
locally. Com object works fine locally but has problem with query
interface remotly. 'Remotly' means via Remoting mechanism. Everything
happens on the same machine so Com Server is registered properly in
system.

Whats wrong here ?
Re: Com object called locally works fine but fails when called from remote object pwl NO[at]SPAM 4me.pl
7/26/2005 6:45:06 AM
Forgot to mention. I use FrameWork 2.0. Dont know if it is an issue
here.
RE: Com object called locally works fine but fails when called from re Kelly Leahy
7/26/2005 9:09:04 AM
Are you passing the reference to the data type (wrapper class) across the
remoting boundary? If so, are you using a shared library for the wrapper
class and/or interface? You need to be using the same library (assembly) for
the classes that get passed between the client and the server.

I don't think either of the things I mentioned are your problem, however.
It seems that for some reason QueryInterface is failing on the pointer you've
acquired from the Com Object. Are you sure you are using the object
correctly? Perhaps you're calling QueryInterface on a different thread from
that on which you created the object or something like that?

Kelly

[quoted text, click to view]
AddThis Social Bookmark Button