Yesterday I got the idea to use remoting for the test interface between our
Windows Xp Embedded - based device and our system test application.
I started looking in the MSDN help and made the code below.
My server class (RemotingServer) is located in one assembly (LibS.dll) used
by the device software and the test system will use another assembly
(LibC.dll) including my client class (TestConnectionRemoting).
We have NO security issues - the interface should be open for any
application using LibS.dll (or any other for that matter).
My immediate problem is that I get a SerilizationException when invoking a
method (the SetEventOutputInterface method call) on the remote object:
"Because of security restrictions, the type System.Runtime.Remoting.ObjRef
cannot be accessed."
- InnerException is SecurityException: "Request failed."
The next question:
I'm passing interface references to the server where one of them will be
saved in the server and used asynchronuosly later. Will I have to do any
preparation for that to work? - and can I do that?
Any help is much appreciated because remoting is not a focus area in this
project so I just have to make this test interface work so I can continue
with my other tasks. Though it is very interesting.....
Here's my code:
--------------- 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 );
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;
}