static void Main(string[] args) { if (!SingleInstance.Start()) { return; } var appHost = new DefaultAppHost(); try { AppInit.Initialize(appHost); Log.Information("BitShelter Agent starting"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var applicationContext = new CustomApplicationContext(); Application.Run(applicationContext); Log.Information("BitShelter Agent stopping"); AppInit.Shutdown(appHost); } catch (Exception ex) { Log.Fatal(ex, "Unrecoverable exception"); MessageBox.Show(ex.Message, "Program Terminated Unexpectedly", MessageBoxButtons.OK, MessageBoxIcon.Error); } SingleInstance.Stop(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseIISPlatformHandler(); app.UseStaticFiles(); app.UseMvc(); AppInit.Initialize(); }
protected override void OnStart(string[] args) { #if DEBUG DebugMode(); #endif try { AppInit.Initialize(this); Log.Information("BitShelter Service started"); } catch (Exception ex) { Log.Error(ex, "Failed to start scheduling service"); // TODO: Handle error throw ex; } }