예제 #1
0
        private static void Main(string[] args)
        {
            // Log everything to console.
            LogFactory.Assign(new ConsoleLogFactory(null));

            Assembly thisAssembly = typeof(Program).Assembly;

            // create a MVC web server.
            var server = new MvcServer();

            server.ViewEngines.Add(new NHamlViewEngine());
            server.Add(HttpListener.Create(IPAddress.Any, 8080));
            server.Add(new SimpleRouter("/", "/user/"));

            // Load controllers and embedded views.
            BootStrapper bootStrapper = new BootStrapper(server);

            bootStrapper.LoadEmbeddedViews(thisAssembly);
            bootStrapper.LoadControllers(thisAssembly);

            server.Start(5);

            // run until you press enter.
            Console.ReadLine();
        }
예제 #2
0
 public CgiModule(HttpServer.HttpListener listener)
 {
     this.listener = listener;
 }
예제 #3
0
파일: GriderProxy.cs 프로젝트: diva/Grider
 private void StartHttpServer()
 {
     HttpServer = HttpListener.Create(log4netLogWriter.Instance, proxyConfig.clientFacingAddress, proxyConfig.loginPort);
     HttpServer.Start(10);
 }
예제 #4
0
 /// <summary>
 /// Initialize the server in HTTPS (TLS 1.0) mode
 /// </summary>
 /// <param name="address">IP address to bind to</param>
 /// <param name="port">Port number to bind to</param>
 /// <param name="certificate">X.509 server certificate for SSL</param>
 /// <param name="rootCA">X.509 certificate for the root certificate authority
 /// that signed the server certificate and/or any client certificates</param>
 /// <param name="requireClientCerts">True if client SSL certificates are
 /// required, otherwise false</param>
 public WebServer(IPAddress address, int port, X509Certificate certificate, X509Certificate rootCA, bool requireClientCerts)
 {
     server = new HttpListener(address, port, certificate, rootCA, System.Security.Authentication.SslProtocols.Tls, requireClientCerts);
     server.RequestHandler += RequestHandler;
 }
예제 #5
0
 /// <summary>
 /// Initialize the server in HTTP mode
 /// </summary>
 /// <param name="address">IP address to bind to</param>
 /// <param name="port">Port number to bind to</param>
 public WebServer(IPAddress address, int port)
 {
     server = new HttpListener(address, port);
     server.RequestHandler += RequestHandler;
 }