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

            mvcService.Start(new string[0], () => { });
            WriteLine("Running interactively, press enter to stop.");
            ReadLine();
            mvcService.Stop();
        }
Ejemplo n.º 2
0
        private 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 MvcTestWin32Service(args.Where(a => a != RunAsServiceFlag).ToArray());
            var serviceHost = new Win32ServiceHost(mvcService);

            serviceHost.Run();
        }