HighTechTalks DotNet Forums  

Type.InvokeMethod not working in remote server object.

Dotnet Framework (Remoting) microsoft.public.dotnet.framework.remoting


Discuss Type.InvokeMethod not working in remote server object. in the Dotnet Framework (Remoting) forum.



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

Default Type.InvokeMethod not working in remote server object. - 09-29-2006 , 05:35 AM






I just started using .NET Remoting.
I have a test system (client) which should connect 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;
}

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.