static void Main(string[] args) { //log.WriteInfo(String.Format("arguments: {0}",String.Join(" ", args))); //Trace.Listeners.Add(new ConsoleTraceListener()); //Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); //handler = ExceptionPointers => { // Process.GetCurrentProcess().Kill(); // return 1; //}; //SetUnhandledExceptionFilter(handler); CommandLineArgs commandLineArgs = null; try { commandLineArgs = CommandLineArgs.Parse(args); controllerUrl = commandLineArgs.GetParamAsString("controller-url"); } catch (Exception err) { dbg.Break(); log.WriteError(err); //log.WriteError("incorrect command line syntax, should be in format: odm-player-host.exe /server-pipe:<pipe-uri> /parent-pid:<parent process id>"); return; } try { //RemotingServices. log.WriteInfo("connecting to controller..."); var controller = RemotingServices.Connect(typeof(IHostController), controllerUrl) as IHostController; if (controller != null) { log.WriteInfo("sending hello to controller..."); var act = controller.Hello(); log.WriteInfo("executing action returned by controller..."); act(controller); log.WriteInfo("sending bye to controller..."); controller.Bye(); } else { dbg.Break(); log.WriteError("failed to connect to controller..."); } } catch (Exception err) { dbg.Break(); log.WriteError(err); //log.WriteInfo(err.Message); } log.WriteInfo("host process terminated...."); }