/* Example18_8.cs provides a server for a well-known singleton object */ using System; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Http; // implementation of ISimpleObject public class SimpleObject : MarshalByRefObject, ISimpleObject { public String ToUpper(String inString) { return(inString.ToUpper()); } } class Example18_8 { public static void Main() { // create and register a channel HttpChannel hchan = new HttpChannel(54321); ChannelServices.RegisterChannel(hchan); // get the type that we're managing Type SimpleObjectType = Type.GetType("SimpleObject"); // register this type and set up an endpoint RemotingConfiguration.RegisterWellKnownServiceType(SimpleObjectType, "SOEndPoint", WellKnownObjectMode.Singleton); // wait for user input to terminate the server Console.WriteLine("Press Enter to halt server"); Console.ReadLine(); } }