示例#1
0
        public void Start(string[] args)
        {
            var install = false;
            var uninstall = false;
            var serviceName = "";

            var options = new OptionSet()
            {
                { "install=", v => { serviceName = v; install = true; } },
                { "uninstall=", v => { serviceName = v; uninstall = true; } }
            };

            try
            {
                options.Parse(args);
            }
            catch (OptionException ex)
            {
                Console.WriteLine(string.Format("error parsing arguments: {0}", ex));
                return;
            }

            if (string.IsNullOrEmpty(serviceName) == false)
                KissCIInstaller.ServiceName = serviceName;

            if (install)
            {
                using (var service = new ServiceManager(serviceName, typeof(KissCIWebService).Assembly))
                {
                    service.Install();
                    return;
                }
            }

            if (uninstall)
            {
                using (var service = new ServiceManager(serviceName, typeof(KissCIWebService).Assembly))
                {
                    service.Uninstall();
                    return;
                }
            }

            var root = DirectoryHelper.ExecutingDirectory().FullName;
            var port = int.Parse(ConfigurationManager.AppSettings["Port"]);
            var webPath = ConfigurationManager.AppSettings["WebPath"];
            if (string.IsNullOrEmpty(webPath))
                webPath = "KissCI.Web";

            var webRoot = Path.IsPathRooted(webPath) ? webPath : Path.Combine(root, webPath);
            var hostName = ConfigurationManager.AppSettings["HostName"];

            var server = new CassiniDev.Server(port, "/", webRoot, IPAddress.Any, hostName);
            server.Start();

            if (Environment.UserInteractive)
            {
                Console.ReadLine();
            }
        }
示例#2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            int port = 8080;

            //while (!Weavver.Net.Helper.IsPortAvailable(port))
            //{
            //     port++;
            //}

            webBrowser1.Navigate("about:blank");
            webBrowser1.Document.Write("Loading...");
            string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);

            //path = path.Substring(6);
            path = path.Substring(0, path.LastIndexOf("\\"));
            string dir = path + "\\www\\";

#if DEBUG
            dir = @"C:\Weavver\Main\Servers\web\c\Inetpub\www";
#endif

            //proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            //proc.StartInfo.FileName = path + @"\vendors\Apache\couchdb\bin\erl.exe";
            //proc.StartInfo.Arguments = "-sasl errlog_type error -s couch";
            //proc.StartInfo.WorkingDirectory = @"C:\Program Files (x86)\Weavver\Core\vendors\Apache\couchdb\bin";
            //proc.Start();

            //dir = @"C:\Program Files\Weavver\Core\www\";

            serv = new CassiniDev.Server(port, "/", dir);
            serv.Start();
            webBrowser1.Navigate("http://www.weavver.local:" + port + "/");
        }
示例#3
0
文件: Form1.cs 项目: weavver/weavver
        private void Form1_Load(object sender, EventArgs e)
        {
            int port = 8080;
               //while (!Weavver.Net.Helper.IsPortAvailable(port))
               //{
               //     port++;
               //}

               webBrowser1.Navigate("about:blank");
               webBrowser1.Document.Write("Loading...");
               string path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase );
               //path = path.Substring(6);
               path = path.Substring(0, path.LastIndexOf("\\"));
               string dir = path + "\\www\\";

            #if DEBUG
               dir = @"C:\Weavver\Main\Servers\web\c\Inetpub\www";
            #endif

               //proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
               //proc.StartInfo.FileName = path + @"\vendors\Apache\couchdb\bin\erl.exe";
               //proc.StartInfo.Arguments = "-sasl errlog_type error -s couch";
               //proc.StartInfo.WorkingDirectory = @"C:\Program Files (x86)\Weavver\Core\vendors\Apache\couchdb\bin";
               //proc.Start();

               //dir = @"C:\Program Files\Weavver\Core\www\";

               serv = new CassiniDev.Server(port, "/", dir);
               serv.Start();
               webBrowser1.Navigate("http://www.weavver.local:" + port + "/");
        }
 public void ServerCanBeRestarted()
 {
     var server = new CassiniDev.Server(Environment.CurrentDirectory);
     server .Start();
     new AutoResetEvent(false).WaitOne(1000);
     server.ShutDown();
     new AutoResetEvent(false).WaitOne(1000);
     server.Start();
     new AutoResetEvent(false).WaitOne(1000);
     server.ShutDown();
 }
示例#5
0
        public void ServerCanBeRestarted()
        {
            var server = new CassiniDev.Server(Environment.CurrentDirectory);

            server.Start();
            new AutoResetEvent(false).WaitOne(1000);
            server.ShutDown();
            new AutoResetEvent(false).WaitOne(1000);
            server.Start();
            new AutoResetEvent(false).WaitOne(1000);
            server.ShutDown();
        }
示例#6
0
        static void Main(string[] args)
        {
            CentralDispatch.ConfigureNlog();
            Logger.Info("Starting NZBDrone WebUI");
            System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(System.Environment.CurrentDirectory);
            var server = new CassiniDev.Server(System.IO.Path.Combine(dir.Parent.Parent.Parent.FullName, "NzbDrone.Web"));
            server.Start();

            System.Diagnostics.Process.Start(server.RootUrl);
            Logger.Info("Server available at: " + server.RootUrl);
            System.Console.ReadLine();
        }
示例#7
0
        public void StartupApp()
        {
            // Initialize Tray Icon
            trayIcon = new NotifyIcon();
            var miExit = new MenuItem();
            miExit.Click += new EventHandler(Exit);
            miExit.Text = "Exit";
            trayIcon.ContextMenu = new ContextMenu(new MenuItem[] { miExit });
            trayIcon.Icon = new System.Drawing.Icon(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("SelfHostedWWA.wwa.ico"));
            trayIcon.Visible = true;

            var path = ConfigurationManager.AppSettings["path"];
            if (string.IsNullOrEmpty(path))
                path = ".";
            var port = ConfigurationManager.AppSettings["port"];
            if (string.IsNullOrEmpty(port))
                port = "8889";
            trayIcon.Text = string.Format("Windows Web Admin (Port {0})", port);
            var srv = new CassiniDev.Server(Convert.ToInt32(port), "/", path, System.Net.IPAddress.Any);
            srv.Start();
        }