public static void Main() { ChannelServices.RegisterChannel(new HttpChannel(0)); RemotingConfiguration.RegisterActivatedClientType(typeof(ClientActivatedType), "http://localhost:8080"); ClientActivatedType CAObject = new ClientActivatedType(); ILease serverLease = (ILease)RemotingServices.GetLifetimeService(CAObject); MyClientSponsor sponsor = new MyClientSponsor(); serverLease.Register(sponsor); // Call same method on the object Console.WriteLine("Client-activated object: " + CAObject.RemoteMethod("Bob")); Console.WriteLine("Press Enter to end the client application domain."); Console.ReadLine(); }
public static void Main() { // Load the configuration file. RemotingConfiguration.Configure("ISponsor_Client.config"); ClientActivatedType clientActivatedObject = new ClientActivatedType(); ILease serverLease = (ILease)RemotingServices.GetLifetimeService(clientActivatedObject); MyClientSponsor sponsor = new MyClientSponsor(); // Note: If you don't pass an initial time, the first request will be taken // from the LeaseTime settings specified in the ISponsor_Server.config file. serverLease.Register(sponsor); Console.WriteLine("Client-activated object.\n" + clientActivatedObject.RemoteMethod()); Console.WriteLine("Press enter to end the client application domain."); Console.ReadLine(); }