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? |