static void Main(string[] args) { LibLocator.Init(); var host = new EventHttpMultiworkerListener(Handler, int.Parse(args[2])); host.Start(args[0], ushort.Parse(args[1])); }
private static void Main(string[] args) { LibLocator.Init(); var rawMode = args.Contains("raw"); const string workerPrefix = "--workers="; var workers = args.Where(a => a.StartsWith(workerPrefix)) .Select(a => int.Parse(a.Substring(workerPrefix.Length))) .FirstOrDefault(); if (workers == 0) { workers = 1; } if (rawMode) { new EventHttpMultiworkerListener( req => req.Respond(HttpStatusCode.OK, new Dictionary <string, string>(), Encoding.UTF8.GetBytes("Hello from thread " + Thread.CurrentThread.ManagedThreadId)), workers).Start( args[0], ushort.Parse(args[1])); } else { var host = new Nancy.Hosting.Event2.NancyEvent2Host(args[0], int.Parse(args[1]), new DefaultNancyBootstrapper(), workers); host.Start(); } }
static void Main(string[] args) { LibLocator.Init(null); var w = new WebServer("127.0.0.1", 8000, Environment.ProcessorCount); w.Start(); }
public static void Main(string[] args) { var host = args[0]; var port = int.Parse(args[1]); var dbHost = args[2]; LibLocator.Init(); NancyBenchmark.DbModule.MYSQL_CONNECTION_STRING = "server=localhost;user id=benchmarkdbuser;password=benchmarkdbpass;database=hello_world" .Replace("localhost", dbHost); AddToIndex(); var threads = 20 * Environment.ProcessorCount; ThreadPool.SetMaxThreads(threads, threads); ThreadPool.SetMinThreads(threads, threads); new NancyEvent2Host(host, port, new DefaultNancyBootstrapper()).Start(); }