Пример #1
0
    public static void Main()
    {
        TcpChannel tcpChannel = new TcpChannel();

        ChannelServices.RegisterChannel(tcpChannel);
        Type requiredType = typeof(MovieTicketInterface);
        MovieTicketInterface remoteObject = (MovieTicketInterface)Activator.GetObject(requiredType,
                                                                                      "tcp://localhost:9998/MovieTicketBooking");

        Console.WriteLine(remoteObject.GetTicketStatus("Ticket No: 3344"));
    }
Пример #2
0
        static void Main(string[] args)
        {
            try
            {
                HttpChannel httpChannel = new HttpChannel();
                ChannelServices.RegisterChannel(httpChannel);

                Type requiredType = typeof(MovieTicketInterface);

                MovieTicketInterface remoteObject = (MovieTicketInterface)Activator.GetObject(requiredType,
                                                                                              "Http://localhost:9998/MovieTicketBooking");

                Console.WriteLine(remoteObject.GetTicketStatus("Ticket No: 3344"));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }