private void startServer(OwinSettings settings, IList <RouteBase> routes, string physicalPath, int port) { var parameters = new StartOptions { Port = port }; parameters.Urls.Add("http://*:" + port); //for netsh http add urlacl // Adding the static middleware settings.AddMiddleware <StaticFileMiddleware>(_services.GetInstance <IFubuApplicationFiles>(), settings); if (physicalPath != null) { FubuMvcPackageFacility.PhysicalRootPath = physicalPath; } Action <IAppBuilder> startup = FubuOwinHost.ToStartup(settings, routes); var context = new StartContext(parameters) { Startup = startup, }; settings.EnvironmentData[OwinConstants.AppMode] = FubuMode.Mode().ToLower(); context.EnvironmentData.AddRange(settings.EnvironmentData.ToDictionary()); var engine = new HostingEngine(new AppBuilderFactory(), new TraceOutputFactory(), new AppLoader(new IAppLoaderFactory[0]), new ServerFactoryLoader(new ServerFactoryActivator(new ServiceProvider()))); try { _server = engine.Start(context); } catch (TargetInvocationException e) { if (e.InnerException != null && e.InnerException.Message.Contains("Access is denied")) { throw new KatanaRightsException(e.InnerException); } throw; } }
private void startServer(IList <RouteBase> routes, string physicalPath, int port) { var parameters = new StartOptions { Port = port }; parameters.Urls.Add("http://*:" + port); //for netsh http add urlacl FubuMvcPackageFacility.PhysicalRootPath = physicalPath ?? AppDomain.CurrentDomain.BaseDirectory; Action <IAppBuilder> startup = FubuOwinHost.ToStartup(routes); var context = new StartContext(parameters) { Startup = startup }; var engine = new HostingEngine(new AppBuilderFactory(), new TraceOutputFactory(), new AppLoader(new IAppLoaderFactory[0]), new ServerFactoryLoader(new ServerFactoryActivator(new ServiceProvider()))); _server = engine.Start(context); }