Exemple #1
0
        private void RunInternal(string[] args)
        {
            Console.WriteLine("Starting server");

            using (var fsHost = new ServiceHost(typeof(FileSystemService)))
                using (var streamHost = new ServiceHost(typeof(FileStreamService)))
                {
                    Console.WriteLine(fsHost.AsString("Hosting {0}", host => host.Description.Name));
                    fsHost.Open();

                    Console.WriteLine(streamHost.AsString("Hosting {0}", host => host.Description.Name));
                    streamHost.Open();

                    Console.WriteLine("Server started");
                    Console.WriteLine("Type 'exit' to stop server");

                    while (true)
                    {
                        var command = Console.ReadLine();

                        if (!string.IsNullOrWhiteSpace(command) && command.ToLower().Equals("exit"))
                        {
                            break;
                        }
                    }
                }
        }