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

Type.InvokeMethod not working in remote server object.

P: n/a
Jan
I just started using .NET Remoting.
I have a test system (client) which connects to our device (server)
running XP Embedded.

When my server object is called it uses a library where reflection
(Type.InvokeMethod) is used to dynamically invoke a "command-object" in a
list.
The list of objects are created when server is started (in UI-thread).
Each entry in the command list stores a Type reference, an object reference
and the method name.
The command is invoked like this:

commands[i].ObjectType.InvokeMember(
commands[i].MethodName,
BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.InvokeMethod,
null, commands[i].ObjectInstance, pars );

When I call this code from the UI-thread (when pressing a button in user
interface) it works fine, but when called from the server object I get a
MissingMethodException from InvokeMember.

Could it be something about permissions? (which I know next-to-nothing about).

Any ideas?


My remoting code is listed below.

--------------- THE CLIENT ( LibC.dll) ---------------

class TestConnectionRemoting : MarshalByRefObject, ITestOutput, IEventOutput
{
AccessorBase m_Accessor = null;

public override bool Connect()
{
WellKnownClientTypeEntry typeentry =
new WellKnownClientTypeEntry( typeof( AccessorBase ),
"tcp://localhost:399/testinterface" );
typeentry.ApplicationUrl = "tcp://localhost:399/testinterface";
RemotingConfiguration.RegisterWellKnownClientType( typeentry );

BinaryClientFormatterSinkProvider sinkprovider =
new BinaryClientFormatterSinkProvider();
IDictionary properties = new Hashtable();
properties["name"] = "TcpBinary";
properties["port"] = 0;

BinaryServerFormatterSinkProvider provider =
new BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel = TypeFilterLevel.Full;

ChannelServices.RegisterChannel(
new TcpChannel( properties, sinkprovider, provider ), false );

m_Accessor = new AccessorBase();

// deliver event-output interface reference
m_Accessor.SetEventOutputInterface( (IEventOutput) this );

// call remote method where output will be sent back through
// the ITestOutput interface.
m_Accessor.ExecuteCommand( (ITestOutput) this, "login developer" );

return true;
}
Sep 29 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.