예제 #1
0
        private static void StartService()
        {
            ServiceHost host = new ServiceHost();

            host.AddService(new HelloWorldService());

            host.StartServiceHost();
            host.OpenServices();

            Console.WriteLine("Press enter to stop server");
            Console.ReadLine();

            host.CloseServices();
            host.StopServiceHost();
        }
예제 #2
0
        private static void StartChatRoomServer(ChatroomSettings settings)
        {
            ServiceHost host = new ServiceHost();

            host.AddService(new ChatroomService(settings));

            host.StartServiceHost();
            host.OpenServices();

            Console.WriteLine("Type \"quit\" to shut down server");

            string input = null;

            do
            {
                input = Console.ReadLine();
                Console.WriteLine(input);
                //TODO: Implement Console Commands
            }
            while (input != "quit");

            host.CloseServices();
            host.StopServiceHost();
        }