Groups | Blog | Home
all groups > dotnet remoting > july 2004 >

dotnet remoting : Remoting and security limit problem,help


whtinkm NO[at]SPAM sina.com
7/20/2004 8:49:23 PM
Hi all

I begin to study .Net remoting recently,and I happend to a problem.
The following is my test code

//share dll
namespace sharedll
{
public class FirstClass:System.MarshalByRefObject
{
public FirstClass()
{
}

public void SetData(SecondClass oneClass)
{
System.Console.WriteLine(oneClass.GetData());
}
}

public class SecondClass:System.MarshalByRefObject
{
public SecondClass()
{
}

public string GetData()
{
return "come from second class";
}
}
}

//server
TcpServerChannel channel=new TcpServerChannel(7777);
ChannelServices.RegisterChannel(channel);

RemotingConfiguration.RegisterWellKnownServiceType(typeof(FirstClass),"
FirstClass ",WellKnownObjectMode.Singleton);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(SecondClass),"
SecondClass ",WellKnownObjectMode.Singleton);

//client
ChannelServices.RegisterChannel(new TcpClientChannel());

FirstClass first=(FirstClass)Activator.GetObject(typeof(FirstClass),"tcp://localhost:7777/
FirstClass ");

SecondClass second=(SecondClass)Activator.GetObject(typeof(SecondClass),"tcp://localhost:7777/
SecondClass");

first.SetData(second); //This call will cast a exception.

It says "Because of security limit,cann't visit type
System.Runtime.Remoting.ObjRef."

Please help
Thanks

Sunny
7/21/2004 9:25:06 AM
Hi,

you need to set typeFilterLevel = "Full".

This is a property of the formatter. So you need to create a server and
client formatters both at the server and client, with the appropriate
constructor, which accepts IDictionary as a parameter.

Then create the channel with the constructor, which accepts IDictionary,
serverformater and clientformatter.

Sunny

In article <4432e092.0407201949.56764c44@posting.google.com>,
whtinkm@sina.com says...
[quoted text, click to view]
whtinkm NO[at]SPAM sina.com
7/22/2004 1:31:01 AM
AddThis Social Bookmark Button