S
SOS
hi guys ,
i'm trying to learn how to use .Net Remoting !
i created a class like this :
public class MyClass : MarshalByRefObject
{
public MyClass()
{
Console.WriteLine("my object created !");
}
public void DoSomething()
{
// do sometthing here
}
}
and i use of a windows application to register this class :
public void Main()
{
HttpServerChannel channel = new HttpServerChannel(8080);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(MyClass),"MyClass"
,WellKnownObjectMode.Singleton);
MessageBox.Show("Registered !");
}
and finally , i use of this code to access the remote object.
but when i try to invoke a method of my remote class , this error occure :
can't connect to remote object ...
public void Main()
{
ChannelServices.RegisterChannel(new HttpServerChannel());
MyClass myclass = (MyClass)
Activator.GetObject(typeof(MyClass),"http://localhost:8080/MyClass");
if (myclass != null)
{
myclass.DoSomething();
}
}
what's wrong ?
Thanx
i'm trying to learn how to use .Net Remoting !
i created a class like this :
public class MyClass : MarshalByRefObject
{
public MyClass()
{
Console.WriteLine("my object created !");
}
public void DoSomething()
{
// do sometthing here
}
}
and i use of a windows application to register this class :
public void Main()
{
HttpServerChannel channel = new HttpServerChannel(8080);
ChannelServices.RegisterChannel(channel);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(MyClass),"MyClass"
,WellKnownObjectMode.Singleton);
MessageBox.Show("Registered !");
}
and finally , i use of this code to access the remote object.
but when i try to invoke a method of my remote class , this error occure :
can't connect to remote object ...
public void Main()
{
ChannelServices.RegisterChannel(new HttpServerChannel());
MyClass myclass = (MyClass)
Activator.GetObject(typeof(MyClass),"http://localhost:8080/MyClass");
if (myclass != null)
{
myclass.DoSomething();
}
}
what's wrong ?
Thanx