locked
.NET remoting rookie. Need HELP! Unhandled Exception RRS feed

  • Question

  • Hi,
    I'm just getting into .NET remoting. I've got my rmotable type,, the listener/server and the client. No compile errors, but i get this run error


    Unhandled Exception: System.Net.Sockets.SocketException: No connection could be
    made because the target machine actively refused it

    Server stack trace:
       at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddre
    ss socketAddress)
       at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
       at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint
     ipEndPoint)
       at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
       at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortA
    ndSid, Boolean openNew)
       at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWit
    hRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
       at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage
    (IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ITranspor
    tHeaders& responseHeaders, Stream& responseStream)
       at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMess
    age(IMessage msg)

    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req
    Msg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa
    ta, Int32 type)
       at System.Object.Equals(Object obj)
       at Client.SampleClient1.Main(String[] args) in C:\Documents and Settings\onib
    iyot\My Documents\Visual Studio 2005\Projects\Client1\Client1\SampleClent1.cs:li
    ne 30
    Press any key to continue . . .

    Can anyone help me out? Thanks
    Tuesday, August 1, 2006 2:43 PM

Answers

  • Finally got a solution. Thanks
    Wednesday, August 2, 2006 2:04 PM
  • My case was a very simple one. I didn't have the server app running when i executed the client.....that was why i was getting that error.

    Can anyone help me out with this --- I've got a  two server remoting app on the same machine....but i get the error Unhandled exception "Requested Service not found" Any ideas?

    Thanks

    sample code from the client
    namespace CLIENT
    {
        public class CLIENT
        {
            public static void Main(string[] args)
            {
                TcpClientChannel chan = new TcpClientChannel();
                ChannelServices.RegisterChannel(chan);

                //create an instance of Scan object
                IScanShared ScanObj = (IScanShared)Activator.GetObject(typeof(IScanShared),
                    "tcp://10.181.54.231:5000/ScanServer");

                //create an instance of TestControl object
                ITestControlShared TestControlObj = (ITestControlShared)Activator.GetObject(
                    typeof(ITestControlShared), "tcp://10.181.54.231:3000/TestControlServer");
    Wednesday, August 16, 2006 2:11 PM

All replies

  • To me it seems that either:

    1) a firewall is blocking that port from accepting connections

    2) the server has not started the connection service in order to "listen" to that port.

     

    I could be wrong but also believe it could be either reason. I have not doing remoting but the socket exceptions I have had before and found out to be the reason

    Tuesday, August 1, 2006 3:31 PM
    Moderator
  • How can i check if the firewall is blocking the port if im behind a corporate firewall that's off but using group policy to control the settings?
    Tuesday, August 1, 2006 4:02 PM
  • I think it maybe more of the local computer's firewall than the network firewall itself. I'm unsure as this is a bit over my head.

     

    How are you connecting the application? Is it on the same machine? Or different machines but on the same network? Or different machines on different networks?

     

    Tuesday, August 1, 2006 4:07 PM
    Moderator
  • Same machine for now. But would later try 2 different machines on the same network
    Tuesday, August 1, 2006 4:10 PM
  • If its on the same machine (connect from same machine to same machine) then it will be a local firewall issue most likely.

    So whichever port you are connecting on (example: 1111) add this to your exception list in your local firewall. How? No idea as all firewall software are different to configure but that is pretty much what you need to do.

     

    It would help us also if you had posted some code :-)

    Tuesday, August 1, 2006 4:13 PM
    Moderator
  • Thanks ahmedilyas.  I tried that b4, its still giving the same problem. ...

    I added a port, gave it a name, indicated the port nbr...but still

    Hmmm... i really really need this thing to work.


    Tuesday, August 1, 2006 4:34 PM
  • If you can give us some code maybe someone else/me could help.

     

    Tuesday, August 1, 2006 5:00 PM
    Moderator
  • Finally got a solution. Thanks
    Wednesday, August 2, 2006 2:04 PM
  • Can you tell me what was the solution as i am also trying to get around with the same error..

    Im making connection to different host like hotmail and all and im getting this error.. Any pointers?
    Thanks in Advance
    Wednesday, August 16, 2006 12:51 PM
  • My case was a very simple one. I didn't have the server app running when i executed the client.....that was why i was getting that error.

    Can anyone help me out with this --- I've got a  two server remoting app on the same machine....but i get the error Unhandled exception "Requested Service not found" Any ideas?

    Thanks

    sample code from the client
    namespace CLIENT
    {
        public class CLIENT
        {
            public static void Main(string[] args)
            {
                TcpClientChannel chan = new TcpClientChannel();
                ChannelServices.RegisterChannel(chan);

                //create an instance of Scan object
                IScanShared ScanObj = (IScanShared)Activator.GetObject(typeof(IScanShared),
                    "tcp://10.181.54.231:5000/ScanServer");

                //create an instance of TestControl object
                ITestControlShared TestControlObj = (ITestControlShared)Activator.GetObject(
                    typeof(ITestControlShared), "tcp://10.181.54.231:3000/TestControlServer");
    Wednesday, August 16, 2006 2:11 PM