ClientSponsor.Close Method
.NET Framework 4.5
Empties the list objects registered with the current ClientSponsor.
Namespace: System.Runtime.Remoting.Lifetime
Assembly: mscorlib (in mscorlib.dll)
class HelloClient { static void Main() { // Register a channel. TcpChannel myChannel = new TcpChannel (); ChannelServices.RegisterChannel(myChannel); RemotingConfiguration.RegisterActivatedClientType( typeof(HelloService),"tcp://localhost:8085/"); // Get the remote object. HelloService myService = new HelloService(); // Get a sponsor for renewal of time. ClientSponsor mySponsor = new ClientSponsor(); // Register the service with sponsor. mySponsor.Register(myService); // Set renewaltime. mySponsor.RenewalTime = TimeSpan.FromMinutes(2); // Renew the lease. ILease myLease = (ILease)mySponsor.InitializeLifetimeService(); TimeSpan myTime = mySponsor.Renewal(myLease); Console.WriteLine("Renewed time in minutes is " + myTime.Minutes.ToString()); // Call the remote method. Console.WriteLine(myService.HelloMethod("World")); // Unregister the channel. mySponsor.Unregister(myService); mySponsor.Close(); } }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.