Sajjad.Aghapour
چهارشنبه 09 بهمن 1387, 19:58 عصر
سلام دوستان....
این خطا در چه صورتی رخ میده....
سرور :
Console.WriteLine("start");
HttpServerChannel channel = new HttpServerChannel(32469);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType (typeof(SimpleRemotingAsm1.RemoteMessageObject), "RemoteMsgObj.soap", WellKnownObjectMode.Singleton);
Console.ReadLine();
کلاینت :
[SecurityPermission(SecurityAction.Demand)]
static void Main(string[] args)
{
Console.WriteLine("start client");
HttpClientChannel c = new HttpClientChannel();
ChannelServices.RegisterChannel(c);
object remoteObj = Activator.GetObject(typeof(SimpleRemotingAsm1.Remo teMessageObject), "http://localhost:32469//RemoteMsgObj.soap");
RemoteMessageObject simple = (RemoteMessageObject)remoteObj;
simple.DisplyMessage("hello from client");
Console.WriteLine("server :{0}", simple.ReturnMessage());
Console.ReadLine();
}
لایه عمومی :
public class RemoteMessageObject : MarshalByRefObject
{
public RemoteMessageObject()
{
MessageBox.Show("construct");
}
public void DisplyMessage(string msg)
{
MessageBox.Show("message is :"+ msg);
}
public string ReturnMessage()
{
return "salam";
}
}
این خطا در چه صورتی رخ میده....
سرور :
Console.WriteLine("start");
HttpServerChannel channel = new HttpServerChannel(32469);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType (typeof(SimpleRemotingAsm1.RemoteMessageObject), "RemoteMsgObj.soap", WellKnownObjectMode.Singleton);
Console.ReadLine();
کلاینت :
[SecurityPermission(SecurityAction.Demand)]
static void Main(string[] args)
{
Console.WriteLine("start client");
HttpClientChannel c = new HttpClientChannel();
ChannelServices.RegisterChannel(c);
object remoteObj = Activator.GetObject(typeof(SimpleRemotingAsm1.Remo teMessageObject), "http://localhost:32469//RemoteMsgObj.soap");
RemoteMessageObject simple = (RemoteMessageObject)remoteObj;
simple.DisplyMessage("hello from client");
Console.WriteLine("server :{0}", simple.ReturnMessage());
Console.ReadLine();
}
لایه عمومی :
public class RemoteMessageObject : MarshalByRefObject
{
public RemoteMessageObject()
{
MessageBox.Show("construct");
}
public void DisplyMessage(string msg)
{
MessageBox.Show("message is :"+ msg);
}
public string ReturnMessage()
{
return "salam";
}
}