Example #1
0
 public WebServer(List<string> urlmaps, string baseFolder, MainWindow mainWindowI)
 {
     this.mainWindow = mainWindowI;
     extension2Mime.Add("txt", "text/plain");
     extension2Mime.Add("html", "text/html");
     extension2Mime.Add("htm", "text/html");
     extension2Mime.Add("sys", "text/html");
     //System.Threading.ThreadPool.SetMaxThreads(50, 1000);
     System.Threading.ThreadPool.SetMaxThreads(((int)MaxThreads*(3/2)), 1000);
     System.Threading.ThreadPool.SetMinThreads(MaxThreads, MaxThreads);
     listener = new HttpListener();
     foreach (var u in urlmaps)
     {
         listener.Prefixes.Add(u);
         Console.WriteLine("Added:"+u);
     }
     this.baseFolder = baseFolder;
 }
 private MicroWebServer.WebServer initWebServer(MainWindow mainWindow)
 {
     List<string> names = new List<string>();
     names.Add("http://" + System.Net.Dns.GetHostName() + ":2323/");
     //var ipadresses=System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName());
     //foreach (var ip in ipadresses)
     //{
     //    //Console.WriteLine(ip.ToString());
     //    names.Add("http://" + ip.ToString() + ":2323/");
     //}
     names.Add("http://*****:*****@"C:\giorgi\ht\htdocs", mainWindow);
     new System.Threading.Thread(server.Start).Start();
     Console.WriteLine("MicroWeb Server is Running. Press ^C to stop");
     return server;
 }