private static void Main(string[] args) { HttpEndpointRegistration.RegisterHttpEndpointTarget(); if (RunningInInteractiveMode(args)) { try { LogManager.EnsureValidLogger(); InteractiveRun(args); } catch (ReflectionTypeLoadException e) { var sb = new StringBuilder(); sb.AppendLine(e.ToString()); foreach (var loaderException in e.LoaderExceptions) { sb.AppendLine("- - - -").AppendLine(); sb.AppendLine(loaderException.ToString()); } WaitForUserInputAndExitWithError(sb.ToString(), args); } catch (Exception e) { EmitWarningInRed(); WaitForUserInputAndExitWithError(e.ToString(), args); } } else { // no try catch here, we want the exception to be logged by Windows ServiceBase.Run(new RavenService()); } }
private static void SetupLogging() { HttpEndpointRegistration.RegisterHttpEndpointTarget(); using (var stream = typeof(StressTest).Assembly.GetManifestResourceStream(typeof(StressTest).Namespace + ".DefaultLogging.config")) using (var reader = XmlReader.Create(stream)) { LogManager.Configuration = new XmlLoggingConfiguration(reader, "default-config"); } }
static void Main(string[] args) { HttpEndpointRegistration.RegisterHttpEndpointTarget(); //using (var documentStore = CreateEmbeddaleDocumentStore().Initialize()) using (var documentStore = CreateRealDocumentStore().Initialize()) { //documentStore.DatabaseCommands. //documentStore.DisableAggressiveCaching(); var demo = new Demo(documentStore); demo.CreateData1(); demo.Run(); Console.ReadLine(); } }
static RavenFilesTestWithLogs() { if (LogManager.Configuration != null) { return; } HttpEndpointRegistration.RegisterHttpEndpointTarget(); using (var stream = typeof(RavenFilesTestWithLogs).Assembly.GetManifestResourceStream("Raven.Tests.FileSystem.DefaultLogging.config")) using (var reader = XmlReader.Create(stream)) { LogManager.Configuration = new XmlLoggingConfiguration(reader, "default-config"); } }
static WithNLog() { if (NLog.LogManager.Configuration != null) { return; } HttpEndpointRegistration.RegisterHttpEndpointTarget(); using (var stream = typeof(RemoteClientTest).Assembly.GetManifestResourceStream("Raven.Tests.DefaultLogging.config")) using (var reader = XmlReader.Create(stream)) { NLog.LogManager.Configuration = new XmlLoggingConfiguration(reader, "default-config"); } }
public static void Init() { if (database != null) { return; } lock (locker) { if (database != null) { return; } log.Info("Setting up RavenDB Http Integration to the ASP.Net Pipeline"); try { var ravenConfiguration = new RavenConfiguration(); HttpEndpointRegistration.RegisterHttpEndpointTarget(); database = new DocumentDatabase(ravenConfiguration); database.SpinBackgroundWorkers(); server = new HttpServer(ravenConfiguration, database); server.Init(); } catch { if (database != null) { database.Dispose(); database = null; } if (server != null) { server.Dispose(); server = null; } throw; } shutdownDetector = new ShutdownDetector(log); shutdownDetector.Initialize(); shutdownDetector.Token.Register(OnShutdown); } }
public static void Init() { if (database != null) { return; } lock (locker) { if (database != null) { return; } log.Info("Setting up RavenDB Http Integration to the ASP.Net Pipeline"); try { var ravenConfiguration = new RavenConfiguration(); HttpEndpointRegistration.RegisterHttpEndpointTarget(); database = new DocumentDatabase(ravenConfiguration); database.SpinBackgroundWorkers(); server = new HttpServer(ravenConfiguration, database); server.Init(); } catch { if (database != null) { database.Dispose(); database = null; } if (server != null) { server.Dispose(); server = null; } throw; } HostingEnvironment.RegisterObject(new ReleaseRavenDBWhenAppDomainIsTornDown()); } }
private static void Main(string[] args) { cmdLineArgs = args; HttpEndpointRegistration.RegisterHttpEndpointTarget(); if (RunningInInteractiveMode(args)) { try { LogManager.EnsureValidLogger(); InteractiveRun(args); } catch (ReflectionTypeLoadException e) { WaitForUserInputAndExitWithError(GetLoaderExceptions(e), args); } catch (InvalidOperationException e) { ReflectionTypeLoadException refEx = null; if (e.InnerException != null) { refEx = e.InnerException.InnerException as ReflectionTypeLoadException; } var errorMessage = refEx != null?GetLoaderExceptions(refEx) : e.ToString(); WaitForUserInputAndExitWithError(errorMessage, args); } catch (Exception e) { EmitWarningInRed(); WaitForUserInputAndExitWithError(e.ToString(), args); } } else { // no try catch here, we want the exception to be logged by Windows ServiceBase.Run(new RavenService()); } }
public static void Init() { if (database != null) { return; } lock (locker) { if (database != null) { return; } try { var ravenConfiguration = new RavenConfiguration(); HttpEndpointRegistration.RegisterHttpEndpointTarget(); database = new DocumentDatabase(ravenConfiguration); database.SpinBackgroundWorkers(); server = new HttpServer(ravenConfiguration, database); server.Init(); } catch { if (database != null) { database.Dispose(); database = null; } if (server != null) { server.Dispose(); server = null; } throw; } } }
private static void Main(string[] args) { HttpEndpointRegistration.RegisterHttpEndpointTarget(); if (RunningInInteractiveMode(args)) { try { InteractiveRun(args); } catch (ReflectionTypeLoadException e) { EmitWarningInRed(); Console.Error.WriteLine(e); foreach (var loaderException in e.LoaderExceptions) { Console.Error.WriteLine("- - - -"); Console.Error.WriteLine(loaderException); } WaitForUserInputAndExitWithError(); } catch (Exception e) { EmitWarningInRed(); Console.Error.WriteLine(e); WaitForUserInputAndExitWithError(); } } else { // no try catch here, we want the exception to be logged by Windows ServiceBase.Run(new RavenService()); } }
static EmbeddableDocumentStore() { HttpEndpointRegistration.RegisterHttpEndpointTarget(); }
public static void Init() { if (database != null) { return; } lock (locker) { if (database != null) { return; } try { var ravenConfiguration = new RavenConfiguration(); if (RoleEnvironment.IsAvailable) { // Mount Cloud drive and set it as Data Directory var currentConfiguredRavenDataDir = ConfigurationManager.AppSettings["Raven/DataDir"] ?? string.Empty; string azureDrive = Environment.GetEnvironmentVariable(RavenDriveConfiguration.AzureDriveEnvironmentVariableName, EnvironmentVariableTarget.Machine); if (string.IsNullOrWhiteSpace(azureDrive)) { throw new ArgumentException("RavenDb drive environment variable is not yet set by worker role. Please, retry in a couple of seconds"); } string azurePath = Path.Combine(azureDrive, currentConfiguredRavenDataDir.StartsWith(@"~\") ? currentConfiguredRavenDataDir.Substring(2) : "Data"); ravenConfiguration.DataDirectory = azurePath; // Read port number specified for this Raven instance and set it in configuration var endpoint = RoleEnvironment.CurrentRoleInstance.InstanceEndpoints["Raven"]; ravenConfiguration.Port = endpoint.IPEndpoint.Port; // When mounting drives in emulator only Munin storage is supported, since drive is not actually present and low level access to it failes (Esent mode) } HttpEndpointRegistration.RegisterHttpEndpointTarget(); database = new DocumentDatabase(ravenConfiguration); database.SpinBackgroundWorkers(); server = new HttpServer(ravenConfiguration, database); server.Init(); } catch { if (database != null) { database.Dispose(); database = null; } if (server != null) { server.Dispose(); server = null; } throw; } HostingEnvironment.RegisterObject(new ReleaseRavenDBWhenAppDomainIsTornDown()); } }
public static void Init() { HttpEndpointRegistration.RegisterHttpEndpointTarget(); DynamicModuleUtility.RegisterModule(typeof(RavenDbStartupAndShutdownModule)); }