private static void Main(string[] args) { var filter = new LogFilter(); filter.AddStandardRules(); //LogFactory.Assign(new ConsoleLogFactory(filter)); // create a server. var server = new Server(); // same as previous example. var module = new FileModule(); module.Resources.Add(new FileResources("/", Environment.CurrentDirectory + "\\files\\")); server.Add(module); server.RequestReceived += OnRequest; server.Add(new MultiPartDecoder()); // use one http listener. server.Add(HttpListener.Create(IPAddress.Any, 8085)); server.Add(new SimpleRouter("/", "/index.html")); // start server, can have max 5 pending accepts. server.Start(5); Console.ReadLine(); }
private static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Console.Title = "Web Server"; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(" Rains Soft Web Server"); Console.WriteLine(" Rains Soft"); Console.WriteLine(" http://www.mobanhou.com"); Console.WriteLine(); Console.ResetColor(); int i = 0; while (true) { if (i > 9) { Console.WriteLine("."); break; } else { Console.Write("."); i++; } System.Threading.Thread.Sleep(500); } var filter = new LogFilter(); filter.AddStandardRules(); var log = new ConsoleLogFactory(filter); LogFactory.Assign(log); Logger = LogFactory.CreateLogger(log.GetType()) as ConsoleAndTextLogger; Logger.Info("create server"); // create a server. var server = new Server(); // same as previous example. var module = new FileModule(); module.Resources.Add(new FileResources("/", Environment.CurrentDirectory + "\\files\\")); server.Add(module); server.Add(new CustomHttpModule()); server.RequestReceived += OnRequest; server.Add(new MultiPartDecoder()); // use one http listener. server.Add(HttpListener.Create(IPAddress.Any, 8085)); server.Add(new SimpleRouter("/", "/index.html")); Logger.Info("start server"); // start server, can have max 5 pending accepts. server.Start(5); Console.Beep(); Console.ReadLine(); }
public NancyHost(IPAddress address, int port, INancyBootstrapper bootStrapper) { var filter = new LogFilter(); filter.AddStandardRules(); LogFactory.Assign(new ConsoleLogFactory(filter)); server = new Server(); bootStrapper.Initialise(); engine = bootStrapper.GetEngine(); // same as previous example. AppiaModule module = new AppiaModule(engine); server.Add(module); }
private static void Main(string[] args) { var filter = new LogFilter(); filter.AddNamespace("SipSharp.Transports.*", LogLevel.Debug); filter.AddStandardRules(); LogFactory.Assign(new ConsoleLogFactory(filter)); var repos = new RegistrationRepository(); repos.Add(new SipUri("*****@*****.**"), "u1000067"); SwitchSharp switchSharp = new SwitchSharp(); switchSharp.RegistrationDatabase = repos; switchSharp.AddListener(new UdpTransport(new IPEndPoint(IPAddress.Any, 5060), switchSharp.MessageFactory)); switchSharp.Start("mydomain.com"); Thread.Sleep(500000); }