By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,980 Members | 877 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,980 IT Pros & Developers. It's quick & easy.

Remoting and the InvokeMember method

P: n/a
I can't use Type.InvokeMember(...) on a remote object.

But when I use Type.InvokeMember(...) on a non-remote object in the
exact same way, I don't have a problem.

Does someone know what I'm doing wrong? Or if using InvokeMember on a
remote object is just a bad idea?

The reason I wish to use InvokeMember rather than to call the method
directly is because I don't want to install the assembly describing
the remote object (in my example, this file is:
Programming_CSharp.ICalc.dll) on the client machine.

HERE IS THE CLIENT-SIDE CODE THAT DOESN'T WORK:
MarshalByRefObject calcObj =
(MarshalByRefObject) RemotingServices.Connect(
typeof(MarshalByRefObject),
"http://localhost:65100/theCalculator");

double sum = (double)calcObj.GetType().InvokeMember("Add",
BindingFlags.Instance | BindingFlags.Public |
BindingFlags.InvokeMethod,
null,
calcObj,
new object [] {3.0,4.0});

THE TYPE OF THE REMOTE OBJECT IS DEFINED ON THE SERVER AS FOLLOWS:
public class Calculator : MarshalByRefObject, ICalc

HERE IS THE ERROR MESSAGE I'M GETTING:
Method System.MarshalByRefObject.Add not found.
Any help would be greatly appreciated,
Jared
Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.