protected void Application_Start(Object sender, EventArgs e) { try { //init State object if (this.IsTransactionAdapterServiceConfiged()) { log4net.Config.XmlConfigurator.Configure(); Task.Factory.StartNew(() => { this.StartHost(); }); } string stateServerID = ConfigurationManager.AppSettings["StateServerID"]; string connectionString = ConfigurationManager.AppSettings["ConnectionString"]; string securityConnectionString = ConfigurationManager.AppSettings["SecurityConnectionString"]; string serverName = ConfigurationManager.AppSettings["ServerName"]; if (string.IsNullOrEmpty(serverName)) { serverName = "StateServer"; } //Check if data is tempered if (!Checker.VerifyHash()) { throw new ApplicationException("Data is tempered, please contact the vendor!"); } string serviceUrl = this.GetLocalServiceUrl(); Application["StateServer"] = Global.StateServer = new StateServer(stateServerID, connectionString, serviceUrl, securityConnectionString); //added by adam on 2009-02-05 string workMode = ConfigurationManager.AppSettings["workMode"]; if (String.Equals(workMode, "Filiale", StringComparison.CurrentCultureIgnoreCase)) { //create FilialeTransactionSwitcher instance, and begin send the failed transaction(if have) in new thread. FilialeTransactionSwitcher.GetInstance(); } AppDebug.LogEvent("StateServer", stateServerID + " started", EventLogEntryType.SuccessAudit); Application["LogManager"] = Global.LogManager = new LogManager(AppType.StateServer, connectionString, 60, serverName); Global.LogManager.LogServiceAction(Common.Log.ServiceAction.Start, DateTime.Now); } catch (Exception ex) { AppDebug.LogEvent("StateServer", ex.ToString(), EventLogEntryType.Error); throw; } }
public static FilialeTransactionSwitcher GetInstance() { if (_Instance == null) { lock (_LockForSingleton) { if (_Instance == null) { FilialeTransactionSwitcher instance = new FilialeTransactionSwitcher(); instance.Initialize(); _Instance = instance; } } } return(_Instance); }