public void Run() { var server = new DotNetServer(new IPEndPoint(IPAddress.Loopback, 80)); var pipes = Pipes .Connect(Static.String("Hello, World!")); var instance = server.Start(); server.Host(new OwinApplication(pipes.AsOwinApp())); Console.WriteLine("Listening..."); Console.ReadKey(); instance.Dispose(); }
public static void Run() { var server = new DotNetServer(); var pipe = server.Start(); server.Host((env, respond, error) => { respond( "200 OK", new Dictionary<string, IList<string>>() { { "Content-Type", new string[] { "text/html" } } }, new object[] { Encoding.ASCII.GetBytes("Hello world.") } ); }); Console.WriteLine("Listening on " + server.ListenEndPoint); Console.WriteLine("Press enter to exit."); Console.ReadLine(); pipe.Dispose(); }
public OwinWebServer() { _server = new DotNetServer(new IPEndPoint(IPAddress.Any,9090)); }