HighTechTalks DotNet Forums  

COM+/InvokeMember problem

Dotnet Framework (Component Services) microsoft.public.dotnet.framework.component_services


Discuss COM+/InvokeMember problem in the Dotnet Framework (Component Services) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default COM+/InvokeMember problem - 12-13-2005 , 10:46 AM






Hi

I've got a COM+ component running on my local machine. I can call a
method on it without any problems using interfaces or by using
GetTypeFromProgID without specifying the server name. However, as soon
as I include the server details InvokeMember fails with:
"Method 'System.__ComObject.TestMethod' not found"

// This is the code I used:
Type t = Type.GetTypeFromProgID("ComPlus.Test", "127.0.0.1", true);
object obj = Activator.CreateInstance(t);

string result = t.InvokeMember("TestMethod",
BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.InvokeMethod,
null, obj, null) as
string;

MessageBox.Show(result , "Return Value");

// However, if I use an interface, it works fine:
Type t = Type.GetTypeFromProgID("ComPlus.Test", "127.0.0.1", true);
ITest test = Activator.CreateInstance(t) as ITest;

string result = test .TestMethod();

MessageBox.Show(result , "Return Value");



Does anyone know what the problem could be? Is there a way around this
without using an interface?


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.