Exemplo n.º 1
0
        public static void RunInteractive(string[] args)
        {
            var mvcService = new MvcWin32Service(args.Where(a => a != InteractiveFlag).ToArray());

            mvcService.Start(new string[0], () => { });
            WriteLine("Running interactively, press enter to stop.");
            Console.ReadLine();
            mvcService.Stop();
        }
Exemplo n.º 2
0
        public static void RunAsService(string[] args)
        {
            // easy fix to allow using default web host builder without changes
            var wdFlagIndex = Array.IndexOf(args, ServiceWorkingDirectoryFlag);

            if (wdFlagIndex >= 0 && wdFlagIndex < args.Length - 1)
            {
                var workingDirectory = args[wdFlagIndex + 1];
                Directory.SetCurrentDirectory(workingDirectory);
            }
            else
            {
                Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location));
            }
            var mvcService  = new MvcWin32Service(args.Where(a => a != RunAsServiceFlag).ToArray());
            var serviceHost = new Win32ServiceHost(mvcService);

            serviceHost.Run();
        }