public static void Main() { Debug.EnableGCMessages(false); Debug.Print("Web Server test software"); // Print the network interface information to the debug interface Microsoft.SPOT.Net.NetworkInformation.NetworkInterface NI = Microsoft.SPOT.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()[0]; //NI.EnableDhcp(); Debug.Print("IP Address = " + NI.IPAddress + ", Gateway = " + NI.GatewayAddress + ", MAC = " + NI.PhysicalAddress); var webServer = new WebServer(null, Resources.ResourceManager); webServer.Add(new RequestRoute("/", Resources.StringResources.Index, "text/html")); webServer.Add(new RequestRoute("/MyStyles.css", Resources.StringResources.MyStyles, "text/css")); webServer.Add(new RequestRoute("/test", HttpMethods.GET, request => new HtmlResponse("Hello World !"))); webServer.Add(new RequestRoute("/redirect", HttpMethods.GET, request => new RedirectResponse("/"))); webServer.Add(new RequestRoute("/api/time", HttpMethods.GET, GetTime)); webServer.Add(new RequestRoute("/api/time", HttpMethods.PUT, SetTime)); Thread.Sleep(Timeout.Infinite); }
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; }