コード例 #1
0
        public void Main()
        {
            channel = new HttpChannel(0);
            ChannelServices.RegisterChannel(channel);
            MarshalByRefObject obj = (MarshalByRefObject)RemotingServices.Connect(
                typeof(IFactorial),
                "http://localhost:60000/MyEndPoint");
            IFactorial cal = (IFactorial)obj;

            Assert.AreEqual(cal.CalculateFactorial(4), 24);
        }
コード例 #2
0
        public void Main()
        {
            Hashtable props = new Hashtable();

            props["port"]   = 0;
            props["bindTo"] = "127.0.0.1";
            channel         = new HttpChannel(props, null, null);
            ChannelServices.RegisterChannel(channel);
            MarshalByRefObject obj = (MarshalByRefObject)RemotingServices.Connect(
                typeof(IFactorial),
                $"http://127.0.0.1:{server.HttpPort}/MyEndPoint");
            IFactorial cal = (IFactorial)obj;

            Assert.AreEqual(cal.CalculateFactorial(4), 24);
        }