Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Missing method exception

13 views
Skip to first unread message

Chevanan@discussions.microsoft.com Ranjith Chevanan

unread,
Nov 18, 2008, 10:43:01 PM11/18/08
to
Hi,

I created a Sample Serviced component in C# and hosted it in the COM+
catalog using "dcomcnfg". Below is the serviced component code listing. I
hosted this in one of my desktop machine.

[ComVisible(true)]

[Guid("288075C7-2A71-4eda-BE98-3A5116797DE4")]

public class MyServicedComp : ServicedComponent, IServiceMgr

{

public MyServicedComp()

{ }

#region IServiceMgr Members

[ComVisible(true)]

public void InvokeService()

{

Console.WriteLine("Invoked the Serviced Component Service");

}

#endregion

}

I created a sample client that will access the aboved hosted serviced
component on my laptop. The code below is my client.

class Program

{

static void Main(string[] args)

{

Guid ultGuid = new Guid("288075C7-2A71-4eda-BE98-3A5116797DE4");//
Guid("A850AC0E-E422-45db-A375-6274BC9D96F8");

Type ServiceMgrType = Type.GetTypeFromCLSID(ultGuid,

"DesktopName");

object ServiceMgr = Activator.CreateInstance(ServiceMgrType);

if (ServiceMgr != null)

{

Console.WriteLine("Not Null");

object methodInfo = ServiceMgrType.InvokeMember("InvokeService",

BindingFlags.InvokeMethod, null, ServiceMgr, null, null, null, null);

}

}

}

Well, everything works fine until now. I make a call to the remote object
from my client it works. The real problem occurs when I copy the serviced
component assembly (MyServicedComp) on my client box (Laptop) and register it
in the GAC(This is a behavior we cannot avoid as it get installed by an
external app which is not under our groups control) Instead of
Activator.CreateInstance(ServiceMgrType) returning a System.__ComObject it
returns a TransparentProxy object which is perplexing. Continuing to run the
code, when the client hits the InvokeMember statement it throws an exception
saying "Method not found".

Now again, when I remove the Serviced Component assembly from the GAC on
my client m/c(laptop) it works fine.

Any idea why does it return a TransparentObject instead of the
System.__ComObject which is the one that gets returned normally and also the
reason why the InvokeMember call fails when the serviced component is locally
installed in the GAC?

Thanks,

Ranjith

Jportelas

unread,
Dec 23, 2008, 9:40:05 AM12/23/08
to
Hi Ranjith

I am not a COM+ expert but I think that if you need to call the remote COM+
component you install a proxy (generated by the component services console
with the contextual menu) in the client machine, so if you also have a real
instance of the component DLL in your local machine, the loader might get
confused and it should call the first reference it can found and maybe the
one in the GAC is it. It seems like the remote client invocation might be
calling a COM method that is not viable when component is not running on COM+.

Bye.

--
JPortela S.
.Net developer

0 new messages