internal static void OnStart(string[] args) { ConsoleColor lastColor; // WebHost: Console.WriteLine("WebHost:"); lastColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Yellow; _webHost = new WebHost(typeof(MvcApplication), "http://*:180/"); _webHost.Modules.AddModule("UrlRouting", new UrlRoutingNetModule()); if (_webHost.Listener == null) { Console.WriteLine("Not Supported"); } else { Console.WriteLine("Endpoint - address: {0}", "http://*:180/"); } Console.WriteLine(); Console.ForegroundColor = lastColor; _webHost.Open(); // ServiceHost: Console.WriteLine("ServiceHost:"); lastColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Yellow; _serviceHost = new ServiceHost(typeof(CaptureService)); foreach (var endpoint in _serviceHost.Description.Endpoints) { Console.WriteLine("Endpoint - address: {0}", endpoint.Address); Console.WriteLine(" - binding name:\t\t{0}", endpoint.Binding.Name); Console.WriteLine(" - contract name:\t\t{0}", endpoint.Contract.Name); Console.WriteLine(); } Console.ForegroundColor = lastColor; _serviceHost.Open(); //catch (TimeoutException timeProblem) { Console.WriteLine(timeProblem.Message); } //catch (CommunicationException commProblem) { Console.WriteLine(commProblem.Message); } }