public EmbeddedFubuMvcServer(FubuApplication application, string physicalPath = null, int port = 5500) { _application = application; _physicalPath = physicalPath ?? AppDomain.CurrentDomain.BaseDirectory; _server = new SelfHostHttpServer(port, physicalPath); _runtime = _application.Bootstrap(); _server.Start(_runtime); _urls = _runtime.Factory.Get <IUrlRegistry>(); _urls.As <UrlRegistry>().RootAt(_server.BaseAddress); UrlContext.Stub(_server.BaseAddress); _services = _runtime.Factory.Get <IServiceLocator>(); _endpoints = new EndpointDriver(_urls); }
public EmbeddedFubuMvcServer(FubuRuntime runtime, string physicalPath = null, int port = 5500, StartParameters parameters = null) { _runtime = runtime; parameters = parameters ?? new StartParameters(); parameters.Port = port; FubuMvcPackageFacility.PhysicalRootPath = physicalPath ?? AppDomain.CurrentDomain.BaseDirectory; //_server = WebApplication.Start<Starter>(port: port, verbosity: 1); var context = new StartContext { Parameters = parameters, }; var settings = new KatanaSettings { LoaderFactory = () => (s => builder => { var host = new FubuOwinHost(_runtime.Routes); builder.Run(host); }), }; var engine = new KatanaEngine(settings); _server = engine.Start(context); _baseAddress = "http://localhost:" + port; _urls = _runtime.Factory.Get <IUrlRegistry>(); _urls.As <UrlRegistry>().RootAt(_baseAddress); UrlContext.Stub(_baseAddress); _services = _runtime.Factory.Get <IServiceLocator>(); _endpoints = new EndpointDriver(_urls); }