Example #1
0
        static void Main(string[] args)
        {
            //Debugger.Launch(); //wait for debugger to launch & attach

            try
            {
                timer.Change(timeout, Timeout.Infinite);

                BasicConfigurator.Configure();

                ParseArguments(args);

                var assembly = Assembly.LoadFrom(AssemblyPath);

                var typeInterface = assembly.GetType(TypeInterface);
                var typeClass     = assembly.GetType(TypeClass);

                runner = new RemoteInstanceRunner(typeInterface, typeClass, Port);

                runner.StartServer();

                AppDomain.CurrentDomain.ProcessExit += delegate
                {
                    runner.StopServer();
                };

                Console.WriteLine("Press enter to stop this process.");
                Console.ReadLine();
            }
            catch (Exception e)
            {
                WriteError(e);
                throw;
            }
        }
Example #2
0
        private static void WriteError(Exception ex)
        {
            var className = TypeClass.Split('.').Last();

            var errorPath = RemoteInstanceRunner.GetErrorFilePath(className, Port);

            string error = ex.Message;

            if (ex.InnerException != null)
            {
                error += " (Inner Exception: ";
                error += ex.InnerException.Message;
                error += ")";
            }

            try
            {
                File.WriteAllText(errorPath, error);
            }
            catch (Exception e)
            {
            }
        }