[Mono-list] Remoting betweem Mono and MS .NET

RoBiK robik@mailbox.sk
Tue, 22 Jun 2004 13:59:45 +0200


Hi,

I'm using MS.NET 1.1.4322.573 and mono build from mono-daily package from
yesterday (20040621). Your sample application works fine (Server running on
FC1 with mono, client on WIN2003 Server with MS.NET). What version of mono
do you use?
Anyway, are you sure, that you pass the right address as a parameter to the
client? I get this sort of exception, when the the server application is not
running at all (or is running somwhere else as defined by the parameter
passed to the client).

Robert


-----Original Message-----
From: mono-list-admin@lists.ximian.com
[mailto:mono-list-admin@lists.ximian.com] On Behalf Of Yuri Leikind
Sent: Montag, 21. Juni 2004 17:24
Cc: mono-list@lists.ximian.com
Subject: Re: [Mono-list] Remoting betweem Mono and MS .NET

On Mon, 21 Jun 2004 16:35:39 +0200
"RoBiK" <robik@mailbox.sk> wrote:

>      I use remoting between Mono and MS.NET, and it works fine for me.
What
>      problems do you have?
>      
>      Robert


I run a remoting server on Linux, and try to use it from the Windows
machine.
Here is my code:

common interface, build as a separate assembly ================== namespace
ProofOfConcepts{
    public interface ITest{
        string SayHello();
    }
}

================== Client

using System;
using System.IO;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;

namespace ProofOfConcepts{    
    class Client{
        
        ITest ar;
        
        public Client(string host, int port, string endPoint){
            HttpChannel channel = new HttpChannel(0);
            ChannelServices.RegisterChannel(channel);
            MarshalByRefObject obj = 
                (MarshalByRefObject) RemotingServices.Connect(
                    typeof(ProofOfConcepts.ITest),
                    "http://" +  host + ":" + port + "/" + endPoint);
            ar = (ITest) obj;
        }

        public string SayHello(){
            return ar.SayHello();
        }
        
        public static void Main(string[] args){
            Client client = new Client(args[0],  60000, "MyEndPoint");
            Console.WriteLine(client.SayHello());
        }
    }
}
================== Server
using System;
using System.IO;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;

namespace ProofOfConcepts{

    public class AssemblyCache : MarshalByRefObject, ITest{
        public string SayHello(){
            return "hello";
        }
    }
    
    class RemotingServer{
        
        public RemotingServer(object obj){
            HttpChannel channel = new HttpChannel(60000);
            ChannelServices.RegisterChannel(channel);
            MarshalByRefObject mobj = (MarshalByRefObject) obj;
            RemotingServices.Marshal(mobj, "MyEndPoint"); 
        }
        
        void Listen(){
            Console.WriteLine("Press Enter to exit...");
            Console.ReadLine( );
        }
        
        public static void Main(){
            AssemblyCache ar = new AssemblyCache();
            RemotingServer rServer = new RemotingServer(ar);
            rServer.Listen();
        }
    }
}
==================

Here is what I get running the client:


Unhandled Exception: System.Net.WebException: The underlying connectio n was
closed: The request was canceled.

Server stack trace:
   at System.Net.HttpWebRequest.CheckFinalStatus()
   at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult async
Result)
   at System.Net.HttpWebRequest.GetRequestStream()
   at System.Runtime.Remoting.Channels.Http.HttpClientTransportSink.Pr
ocessAndSend(IMessage msg, ITransportHeaders headers, Stream inputStre
am)
   at System.Runtime.Remoting.Channels.Http.HttpClientTransportSink.Pr
ocessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream re
questStream, ITransportHeaders& responseHeaders, Stream& responseStrea
m)
   at System.Runtime.Remoting.Channels.SoapClientFormatterSink.SyncPro
cessMessage(IMessage msg)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IM
essage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageD
ata& msgData, Int32 type)
   at ProofOfConcepts.ITest.SayHello()
   at ProofOfConcepts.Client.Main(String[] args) =======================

My Mono version is 0.95,  MS .NET version 1.1.4322


--
Best regards,
Yuri Leikind


_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list