public EzServiceHost(Configuration oCfg, EzServiceInstanceRuntimeData oData) : base( typeof(EzServiceImplementation), new Uri(oCfg.AdminEndpointAddress), new Uri(oCfg.ClientEndpointAddress) ) { m_oCfg = oCfg; m_oData = oData; var oTcpBinding = new NetTcpBinding { MaxReceivedMessageSize = 2147483647, MaxBufferSize = 2147483647, }; AddServiceEndpoint(typeof(IEzServiceAdmin), oTcpBinding, m_oCfg.AdminEndpointAddress); // To enable HTTP binding on custom port: open cmd.exe as administrator and // netsh http add urlacl url=http://+:7082/ user=ALEXBO-PC\alexbo // where 7082 is your customer port and ALEXBO-PC\alexbo is the user // who runs the instance of the host. // To remove permission: // netsh http add urlacl url=http://+:7082/ // Mind the backslash at the end of the URL. // TODO: restore with HTTPS AddServiceEndpoint(typeof(IEzService), oTcpBinding, m_oCfg.AdminEndpointAddress); //var oHttpBinding = new WSHttpBinding(); //oHttpBinding.Security.Mode = SecurityMode.Transport; //oHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows; //AddServiceEndpoint(typeof(IEzService), oHttpBinding, m_oCfg.ClientEndpointAddress); } // constructor
public Job(EzServiceInstanceRuntimeData oRuntimeData, SafeReader sr, TypeRepository oTypeRepo) { WhyNotStarting = "never checked whether it is time to start"; m_oRuntimeData = oRuntimeData; m_oArguments = new List <JobArgument>(); sr.Fill(this); AddArgument(sr, oTypeRepo); } // constructor
} // InitInstanceName private bool Init() { m_oDB = new SqlConnection(m_oEnv, m_oLog); if (m_oDB == null) { throw new Exception("Failed to create a DB connection."); } if (!InitInstanceName()) { return(false); } m_oCfg = new Configuration(m_sInstanceName, m_oDB, m_oLog); m_oCfg.Init(); var oRuntimeData = new EzServiceInstanceRuntimeData { Env = m_oEnv, Host = this, Log = m_oLog, DB = m_oDB, InstanceName = m_sInstanceName, InstanceID = m_oCfg.InstanceID, }; m_oHost = new EzServiceHost(m_oCfg, oRuntimeData); CurrentValues.ReloadOnTimer oOnTimer = () => { DbConnectionPool.ReuseCount = CurrentValues.Instance.ConnectionPoolReuseCount; AConnection.UpdateConnectionPoolMaxSize(CurrentValues.Instance.ConnectionPoolMaxSize); }; CurrentValues.Init(m_oDB, m_oLog); CurrentValues.Instance.RefreshIntervalMinutes = CurrentValues.Instance.EzServiceUpdateConfiguration; Scanner.Register(); ObjectFactory.Configure(x => { x.For <ISession>().LifecycleIs(new ThreadLocalStorageLifecycle()).Use(ctx => NHibernateManager.OpenSession()); x.For <ISessionFactory>().Use(() => NHibernateManager.SessionFactory); x.AddRegistry <ServiceRegistry>(); }); oOnTimer(); CurrentValues.OnReloadByTimer += oOnTimer; m_oCrontabDaemon = new Daemon(oRuntimeData, m_oDB, m_oLog); return(true); } // Init
} // static constructor public EzServiceImplementation(EzServiceInstanceRuntimeData oData) { if (!NewInstancesAllowed) { throw new FaultException("Cannot create " + InstanceName + " instance: new instances are disabled."); } this.data = oData; Ezbob.Backend.Strategies.Library.Initialize( ReferenceEquals(this.data, null) ? null : this.data.Env, ReferenceEquals(this.data, null) ? null : this.data.DB, ((this.data != null) && (this.data.Log != null)) ? this.data.Log : new SafeLog() ); Log.Msg("{0} instance created.", InstanceName); } // constructor
public Daemon(EzServiceInstanceRuntimeData oData, AConnection oDB, ASafeLog oLog) { if (oDB == null) { throw new NullReferenceException("Database connection not specified."); } if (oData == null) { throw new NullReferenceException("Service instance runtime data not specified."); } m_oLastCheckedMinute = null; m_oStopLock = new object(); m_bStopFlag = false; m_oDB = oDB; m_oLog = oLog.Safe(); m_oData = oData; m_oTypeRepo = new TypeRepository(m_oLog); } // constructor
public EzInstanceProviderBehaviour(EzServiceInstanceRuntimeData oData) { m_oData = oData; } // constructor
public EzServiceInstanceCreator(EzServiceInstanceRuntimeData oData) { m_oData = oData; } // constructor