[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Can't connect to remote object

SOS

10/11/2004 8:21:00 PM

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




2 Answers

Ken Kolda

10/11/2004 9:10:00 PM

0

Your client app is using a server channel. In general, I never specifically
use the HttpServerChannel/HttpClientChannel -- I just use HttpChannel on
both client and server and let the remoting system do the rest.

Ken


"SOS" <SOS@dd> wrote in message
news:emQxND9rEHA.1644@tk2msftngp13.phx.gbl...
> 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
>
>
>
>


Sam Santiago

10/11/2004 9:11:00 PM

0

Trying starting with this example from Microsoft Quickstart examples:

http://samples.gotdotnet.com/quickstart/howto/doc/remoting/mainfea...

Thanks,

Sam

--
_______________________________
Sam Santiago
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTe...
_______________________________
"SOS" <SOS@dd> wrote in message
news:emQxND9rEHA.1644@tk2msftngp13.phx.gbl...
> 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
>
>
>
>