protected override void ConfigureImpl(FileInfo configFile) { base.ConfigureImpl(configFile); this._server.Add(String.IsNullOrEmpty(this.Configuration.CertificationFile) ? HttpListener.Create( IPAddress.Parse(this.Configuration.ListenAddress), this.Configuration.ListenPort ) : HttpListener.Create( IPAddress.Parse(this.Configuration.ListenAddress), this.Configuration.ListenPort, X509Certificate.CreateFromCertFile(this.Configuration.CertificationFile) ) ); this._server.ViewEngines.Add(new SparkEngine()); this._server.Add(new SimpleRouter("/", "/view/")); this._server.Add(new RequestHandler(this)); BootStrapper bootStrapper = new BootStrapper(this._server); bootStrapper.LoadEmbeddedViews(typeof(HttpServant).Assembly); bootStrapper.LoadControllers(typeof(HttpServant).Assembly); }
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(); }