D
Dan
I posted the following on the remoting board, but it doesn't look like
there is a lot of traffic there. Maybe someone has an idea of what I
should try here. That is if everyone's full attention on the C# vs. C
battle.
I have set up a little app to work out how I am going to decouple the
parts of my larger app using remoting. I am trying to pass an object
by reference to an SAO. I first got the security error that was added
for 1.1. So, I am using the extended ctor for HttpChannel. I now,
however, get a new error:
System.ArgumentNullException: No message was deserialized prior to
calling the DispatchChannelSink
I am trying to set this up in the code as opposed to a config file for
other reasons.
Samples:
//Shared Assembly
[Serializable]
public class PassedParam1 : object, IDo
{
public PassedParam1()
{
Console.WriteLine("PassedParam1.ctor");
}
public void Do(string Message)
{
Console.WriteLine("PassedParam1: " + Message);
}
}
public class PassedParam2 : MarshalByRefObject, IDo
{
public PassedParam2()
{
Console.WriteLine("PassedParam2.ctor");
}
public void Do(string Message)
{
Console.WriteLine("PassedParam2: " + Message);
}
}
public interface IDo
{
void Do(string Message);
}
public class Worker : MarshalByRefObject
{
public Worker()
{
Console.WriteLine("Worker.ctor");
}
public void Do(IDo PassedObj)
{
PassedObj.Do("Server Message");
}
}
//Server - Configuration copied from thinktecture.com
BinaryServerFormatterSinkProvider serverProv = new
BinaryServerFormatterSinkProvider();
serverProv.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientProv = new
BinaryClientFormatterSinkProvider();
IDictionary props = new Hashtable();
props["port"] = 1234;
HttpChannel chan =
new HttpChannel(props, clientProv, serverProv);
ChannelServices.RegisterChannel( chan );
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(Worker),
"Worker",
WellKnownObjectMode.SingleCall);
//Client
IDo p1 = new PassedParam1();
IDo p2 = new PassedParam2();
ChannelServices.RegisterChannel(new HttpChannel(0));
Worker w = (Worker)
RemotingServices.Connect(
typeof(Worker),
@"http://localhost:1234/worker");
w.Do(p1);
w.Do(p2);
If I use the standard channel ctor, the first one (ByVal) works fine.
If I use the detailed ctor as in the code above I get that Null Arg
error.
Could someone please point out what I have missed.
TIA,
Dan
there is a lot of traffic there. Maybe someone has an idea of what I
should try here. That is if everyone's full attention on the C# vs. C
battle.
I have set up a little app to work out how I am going to decouple the
parts of my larger app using remoting. I am trying to pass an object
by reference to an SAO. I first got the security error that was added
for 1.1. So, I am using the extended ctor for HttpChannel. I now,
however, get a new error:
System.ArgumentNullException: No message was deserialized prior to
calling the DispatchChannelSink
I am trying to set this up in the code as opposed to a config file for
other reasons.
Samples:
//Shared Assembly
[Serializable]
public class PassedParam1 : object, IDo
{
public PassedParam1()
{
Console.WriteLine("PassedParam1.ctor");
}
public void Do(string Message)
{
Console.WriteLine("PassedParam1: " + Message);
}
}
public class PassedParam2 : MarshalByRefObject, IDo
{
public PassedParam2()
{
Console.WriteLine("PassedParam2.ctor");
}
public void Do(string Message)
{
Console.WriteLine("PassedParam2: " + Message);
}
}
public interface IDo
{
void Do(string Message);
}
public class Worker : MarshalByRefObject
{
public Worker()
{
Console.WriteLine("Worker.ctor");
}
public void Do(IDo PassedObj)
{
PassedObj.Do("Server Message");
}
}
//Server - Configuration copied from thinktecture.com
BinaryServerFormatterSinkProvider serverProv = new
BinaryServerFormatterSinkProvider();
serverProv.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientProv = new
BinaryClientFormatterSinkProvider();
IDictionary props = new Hashtable();
props["port"] = 1234;
HttpChannel chan =
new HttpChannel(props, clientProv, serverProv);
ChannelServices.RegisterChannel( chan );
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(Worker),
"Worker",
WellKnownObjectMode.SingleCall);
//Client
IDo p1 = new PassedParam1();
IDo p2 = new PassedParam2();
ChannelServices.RegisterChannel(new HttpChannel(0));
Worker w = (Worker)
RemotingServices.Connect(
typeof(Worker),
@"http://localhost:1234/worker");
w.Do(p1);
w.Do(p2);
If I use the standard channel ctor, the first one (ByVal) works fine.
If I use the detailed ctor as in the code above I get that Null Arg
error.
Could someone please point out what I have missed.
TIA,
Dan