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")); }
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); } }