public IRubyService CreateService(string command_line_string) { CommandLine switches = CommandLine.FromString(command_line_string); if(switches.HasSwitch("debug")) { Debugger.Launch(); } string config_file_name = switches .GetSwitchValue(S.kConfigFileNameSwitch, S.kDefaultConfigFileName); string config_root_node = switches .GetSwitchValue(S.kConfigRootNodeSwitch, S.kDefaultConfigRootNode); Settings settings = new Settings.Loader() .Load(Path.AbsoluteForCallingAssembly(config_file_name), config_root_node); var app = new AppFactory(settings); return app.CreateService(); }
protected void Application_Start(object sender, EventArgs e) { string config_file_name = WebConfigurationManager.AppSettings[Strings.kConfigFileNameKey]; string config_file_path = Server.MapPath(config_file_name); Settings settings = new Settings.Loader() .Load(config_file_path, Strings.kConfigRootNodeName); var factory = new HttpQueryApplicationFactory(settings); factory.ConfigureLogger(); // log any unhandled exception that may occur for futher investigation. AppDomain.CurrentDomain.UnhandledException += (obj, args) => HttpQueryLogger.ForCurrentProcess.Error( string.Format(StringResources.Log_ThrowsException, "Application"), (System.Exception) args.ExceptionObject); HttpQueryApplication app = factory.CreateQueryApplication(); Application[Strings.kApplicationKey] = app; app.Start(); }