无法使用 C sharp 构建分布式计算器系统

Having Trouble building a distributed calculator system with C sharp

有人可以帮我解决这个问题吗?此代码旨在从客户端系统获取 2 个数字,并使用客户端服务器代码将这两个数字和 return 数字相加到客户端,但实际上,输入数字时,只有无输出

客户端代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CalcService;

namespace CalcClient
{
    class Program
    {
        static void Main(string[] args)
        {
            Type requiredType = typeof(ICalculator);
            ICalculator proxyRemoteObject = 
                (ICalculator)Activator.GetObject(requiredType, "tcp://10.10.10.10:500/Serverone");

            Console.WriteLine("Number 1: ");
            int number1 = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Number 2: ");
            int number2 = Convert.ToInt32(Console.ReadLine());

            int answer = proxyRemoteObject.AddNumbers(number1, number2);
            Console.WriteLine("Answer: " + answer);

            Console.ReadLine();
        }
    }
}

服务代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CalcService
{
    public interface ICalculator
    {
        int AddNumbers(int number1, int number2);
    }
}

服务器代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting;
using CalcService;

namespace CalcServer
{
    class Program
    {
        static void Main(string[] args)
        {
            TcpChannel channel = new TcpChannel(500);
            ChannelServices.RegisterChannel(channel,false);

            RemotingConfiguration.RegisterWellKnownServiceType(typeof(MyCalculator), "Serverone", WellKnownObjectMode.SingleCall);

            Console.WriteLine("Server is running");
            Console.ReadLine();
        }
    }

    public class MyCalculator: MarshalByRefObject, ICalculator
    {
        public int AddNumbers(int num1, int num2)
        {
            return num1 + num2;
        }
    }
}

将服务器更改为 127.0.0.1 解决了问题!抱歉浪费任何人的时间。谢谢用户 Henk!