/// <summary> /// 类型:方法 /// 名称:CharacterCollection /// 作者:taixihuase /// 作用:构造 CharacterCollection 对象 /// 编写日期:2015/7/22 /// </summary> public CharacterCollection(ServerApplication server) { GamingClientsToBroadcast = new List<ServerPeer>(); UniqueIdToCharacterOriginal = new Dictionary<int, Character>(); UniqueIdToCharacterCopy = new Dictionary<int, Character>(); Server = server; }
private void Start_(string connectionString, string applicationName) { var serverApplication = new ServerApplication(); // moduleBases.Each(@base => serverApplication.Modules.Add(@base)); serverApplication.ApplicationName = applicationName; serverApplication.ConnectionString = connectionString; Type securityType = typeof(SecurityComplex).MakeGenericType(new[] { SecuritySystem.UserType, ((ISecurityComplex)SecuritySystem.Instance).RoleType }); serverApplication.Security = (ISecurity)Activator.CreateInstance(securityType, new WorkflowServerAuthentication(new BinaryOperator("UserName", "WorkflowService"))); // serverApplication.Security = new SecurityComplex<User, Role>( // new WorkflowServerAuthentication(new BinaryOperator("UserName", "WorkflowService"))); serverApplication.Setup(); serverApplication.Logon(); IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider; server = new XpandWorkflowServer(ConfigurationManager.AppSettings["WorkflowServerUrl"], objectSpaceProvider, objectSpaceProvider); server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e) { e.WorkflowInstanceStoreBehavior.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2); }; // server.WorkflowDefinitionProvider = new WorkflowVersionedDefinitionProvider<XpoWorkflowDefinition, XpoUserActivityVersion>(objectSpaceProvider, null); server.WorkflowDefinitionProvider = new XpandWorkflowDefinitionProvider(typeof(XpoWorkflowDefinition), new List<Type> { typeof(ScheduledWorkflow), typeof(ObjectChangedWorkflow) }); server.StartWorkflowListenerService.DelayPeriod = TimeSpan.FromSeconds(5); server.StartWorkflowByRequestService.RequestsDetectionPeriod = TimeSpan.FromSeconds(5); server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromSeconds(30); server.Start(); server.CustomHandleException += delegate(object sender, DevExpress.ExpressApp.Workflow.ServiceModel.CustomHandleServiceExceptionEventArgs e) { Tracing.Tracer.LogError(e.Exception); if (OnCustomHandleException_ != null) { OnCustomHandleException_(this, new ExceptionEventArgs("Exception occurs:\r\n\r\n" + e.Exception.Message + "\r\n\r\n'" + e.Service.GetType() + "' service")); } e.Handled = true; }; }
protected override void Setup() { LogManager.SetLoggerFactory(Log4NetLoggerFactory.Instance); Log = LogManager.GetCurrentClassLogger(); GlobalContext.Properties["LogFileName"] = ApplicationName; XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(BinaryPath, "log4net.config"))); var config = new ConfigurationBuilder(); config.AddXmlFile(Path.Combine(BinaryPath, ApplicationName + ".config")); // config.AddJsonFile(Path.Combine(BinaryPath, ApplicationName + ".json")); var module = new ConfigurationModule(config.Build()); // Create the autofac container var builder = new ContainerBuilder(); builder.RegisterInstance(this).SingleInstance(); builder.RegisterInstance(Log).As <ILogger>().SingleInstance(); builder.RegisterModule(module); var container = builder.Build(); ServerApplication = container.Resolve <IServerApplication>(); ServerApplication.Setup(); PeerFactory = container.Resolve <IPeerFactory>(); }
/// <summary> /// 类型:方法 /// 名称:CharacterCollection /// 作者:taixihuase /// 作用:构造 CharacterCollection 对象 /// 编写日期:2015/7/22 /// </summary> public CharacterCollection(ServerApplication server) { GamingClientsToBroadcast = new List <ServerPeer>(); UniqueIdToCharacterOriginal = new Dictionary <int, Character>(); UniqueIdToCharacterCopy = new Dictionary <int, Character>(); Server = server; }
protected override void Initialize() { _mainMenu = new MainMenu(); _server = new ServerApplication(_graphics.GraphicsDevice, Content); _client = new ClientApplication(_graphics.GraphicsDevice, Content); base.Initialize(); }
static void Main(string[] args) { IServer serverApp = new ServerApplication(); serverApp.SetUp(); AddDefaultRooms(); FN.Logger.Info($"FrameRate {FN.Settings.FrameRate}"); Run(serverApp); serverApp.TearDown(); }
private static void StartGrpcServer(ServerApplication opcuaServer, AppSettings appSettings) { var grpcServer = new Grpc.Core.Server { Services = { OpcuaServerService.BindService(new OpcuaServerApi(opcuaServer)) }, Ports = { new ServerPort(appSettings.GrpcHost, appSettings.GrpcPort, ServerCredentials.Insecure) } }; grpcServer.Start(); }
/// <summary> /// 类型:方法 /// 名称:UserCollection /// 作者:taixihuase /// 作用:构造 UserCollection 对象 /// 编写日期:2015/7/12 /// </summary> public UserCollection(ServerApplication server) { Server = server; ConnectedClients = new Dictionary<Guid, ServerPeer>(); ConnectedClientsToBroadcast = new List<ServerPeer>(); GuidToUniqueId = new Dictionary<Guid, int>(); AccountToUniqueId = new Dictionary<string, int>(); UniqueIdToUser = new Dictionary<int, UserInfo>(); NicknameToUniqueId = new Dictionary<string, int>(); }
/// <summary> /// 类型:方法 /// 名称:UserCollection /// 作者:taixihuase /// 作用:构造 UserCollection 对象 /// 编写日期:2015/7/12 /// </summary> public UserCollection(ServerApplication server) { Server = server; ConnectedClients = new Dictionary <Guid, ServerPeer>(); ConnectedClientsToBroadcast = new List <ServerPeer>(); GuidToUniqueId = new Dictionary <Guid, int>(); AccountToUniqueId = new Dictionary <string, int>(); UniqueIdToUser = new Dictionary <int, UserInfo>(); NicknameToUniqueId = new Dictionary <string, int>(); }
private static void StartOpcuaServer(ServerApplication opcuaServer, AppSettings appSettings, ILogger logger) { var master = new LibUA.Server.Master(opcuaServer, appSettings.OpcuaPort, appSettings.Timeout, appSettings.Backlog, appSettings.MaxClients, logger); master.Start(); var timer = new Timer(appSettings.MonitoringInterval); timer.Elapsed += (sender, e) => { opcuaServer.PlayRow(); }; timer.Start(); }
private void StopSession() { if (_clientApplication == null) { return; } _serverApplication?.Dispose(); _clientApplication?.Dispose(); _serverApplication = null; _clientApplication = null; _synchronizationData.Clear(); OnSessionEnd(); }
static void Main(string[] args) { var settingsFile = "FixAtServer.cfg"; if (args.Length >= 1) { settingsFile = args[0]; } Console.WriteLine("Starting server ..."); try { var settings = new SessionSettings(settingsFile); var server = new ServerApplication(Console.WriteLine); var storeFactory = new FileStoreFactory(settings); var logFactory = new FileLogFactory(settings); var acceptor = new ThreadedSocketAcceptor(server, storeFactory, settings, logFactory); acceptor.Start(); Console.WriteLine("Server started"); Console.WriteLine("Press Ctrl-C to quit"); // TODO A better stop mechanism! // http://stackoverflow.com/questions/177856/how-do-i-trap-ctrl-c-in-a-c-sharp-console-app Console.CancelKeyPress += (sender, e) => { Console.WriteLine("Stopping server ..."); acceptor.Stop(); server.Stop(); Console.WriteLine("Server stopped"); }; while (true) { System.Threading.Thread.Sleep(1000); } } catch (Exception e) { Console.WriteLine("Error: {0}", e); } }
private void Start_(string connectionString, string applicationName) { ServerApplication serverApplication = new ServerApplication(); serverApplication.ApplicationName = applicationName; serverApplication.Modules.Add(new WorkflowDemoEFModule()); serverApplication.ConnectionString = connectionString; WorkflowModule workflowModule = serverApplication.Modules.FindModule <WorkflowModule>(); serverApplication.Setup(); serverApplication.Logon(); IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider; server = new WorkflowServer("http://localhost:46232", objectSpaceProvider, objectSpaceProvider); server.StartWorkflowListenerService.DelayPeriod = TimeSpan.FromSeconds(10); server.StartWorkflowByRequestService.DelayPeriod = TimeSpan.FromSeconds(10); server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromSeconds(15); server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e) { // // NOTE: Uncomment this section to use alternative workflow configuration. // // // // SqlWorkflowInstanceStoreBehavior // // // //e.WorkflowInstanceStoreBehavior = null; // //System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior sqlWorkflowInstanceStoreBehavior = new System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior("Integrated Security=SSPI;Pooling=false;Data Source=(local);Initial Catalog=WorkflowsStore"); // //sqlWorkflowInstanceStoreBehavior.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2); // //e.Host.Description.Behaviors.Add(sqlWorkflowInstanceStoreBehavior); //e.WorkflowIdleBehavior.TimeToPersist = TimeSpan.FromSeconds(10); e.WorkflowIdleBehavior.TimeToUnload = TimeSpan.FromSeconds(10); e.WorkflowInstanceStoreBehavior.WorkflowInstanceStore.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(1); }; server.CustomHandleException += delegate(object sender, CustomHandleServiceExceptionEventArgs e) { Tracing.Tracer.LogError(e.Exception); if (OnCustomHandleException_ != null) { OnCustomHandleException_(this, new ExceptionEventArgs("Exception occurs:\r\n\r\n" + e.Exception.Message + "\r\n\r\n'" + e.Service.GetType().FullName + "' service")); } e.Handled = true; }; server.Start(); }
private void Provider() { if (serverApplication == null) { string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition(); var serverApplication = new ServerApplication(); serverApplication.ApplicationName = "WinCTB_CTS"; serverApplication.Modules.Add(new WinCTB_CTSModule()); serverApplication.DatabaseVersionMismatch += ServerApplication_DatabaseVersionMismatch; serverApplication.CreateCustomObjectSpaceProvider += ServerApplication_CreateCustomObjectSpaceProvider; serverApplication.ConnectionString = connectionString; EnumProcessingHelper.RegisterEnum(typeof(CampoPipe), "CampoPipe"); XpoTypesInfoHelper.GetXpoTypeInfoSource(); XafTypesInfo.Instance.RegisterEntity(typeof(Contrato)); XafTypesInfo.Instance.RegisterEntity(typeof(Contrato)); XafTypesInfo.Instance.RegisterEntity(typeof(ReportDataV2)); XafTypesInfo.Instance.RegisterEntity(typeof(FileData)); XafTypesInfo.Instance.RegisterEntity(typeof(BaseObject)); XafTypesInfo.Instance.RegisterEntity(typeof(ReportsModuleV2)); XafTypesInfo.Instance.RegisterEntity(typeof(DashboardData)); XafTypesInfo.Instance.RegisterEntity(typeof(OidGenerator)); XafTypesInfo.Instance.RegisterEntity(typeof(FileAttachmentBase)); //foreach (string parameterName in ParametersFactory.GetRegisteredParameterNames()) //{ // IParameter parameter = ParametersFactory.FindParameter(parameterName); // if (parameter.IsReadOnly && (CriteriaOperator.GetCustomFunction(parameter.Name) == null)) // CriteriaOperator.RegisterCustomFunction(new ReadOnlyParameterCustomFunctionOperator(parameter)); //} serverApplication.Setup(); serverApplication.CheckCompatibility(); this.serverApplication = serverApplication; } }
private void Start_(string connectionString, string applicationName) { var serverApplication = new ServerApplication(); // moduleBases.Each(@base => serverApplication.Modules.Add(@base)); serverApplication.ApplicationName = applicationName; serverApplication.ConnectionString = connectionString; Type securityType = typeof(SecurityComplex).MakeGenericType(new[] { SecuritySystem.UserType, ((ISecurityComplex)SecuritySystem.Instance).RoleType }); serverApplication.Security = (ISecurity)Activator.CreateInstance(securityType, new WorkflowServerAuthentication(new BinaryOperator("UserName", "WorkflowService"))); // serverApplication.Security = new SecurityComplex<User, Role>( // new WorkflowServerAuthentication(new BinaryOperator("UserName", "WorkflowService"))); serverApplication.Setup(); serverApplication.Logon(); IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider; server = new XpandWorkflowServer(ConfigurationManager.AppSettings["WorkflowServerUrl"], objectSpaceProvider, objectSpaceProvider); server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e) { e.WorkflowInstanceStoreBehavior.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2); }; // server.WorkflowDefinitionProvider = new WorkflowVersionedDefinitionProvider<XpoWorkflowDefinition, XpoUserActivityVersion>(objectSpaceProvider, null); server.WorkflowDefinitionProvider = new XpandWorkflowDefinitionProvider(typeof(XpoWorkflowDefinition), new List <Type> { typeof(ScheduledWorkflow), typeof(ObjectChangedWorkflow) }); server.StartWorkflowListenerService.DelayPeriod = TimeSpan.FromSeconds(5); server.StartWorkflowByRequestService.RequestsDetectionPeriod = TimeSpan.FromSeconds(5); server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromSeconds(30); server.Start(); server.CustomHandleException += delegate(object sender, DevExpress.ExpressApp.Workflow.ServiceModel.CustomHandleServiceExceptionEventArgs e) { Tracing.Tracer.LogError(e.Exception); if (OnCustomHandleException_ != null) { OnCustomHandleException_(this, new ExceptionEventArgs("Exception occurs:\r\n\r\n" + e.Exception.Message + "\r\n\r\n'" + e.Service.GetType() + "' service")); } e.Handled = true; }; }
private void StartSession() { _synchronizationData.myName.Value = _connectionHandle.PlayerName; var clientConnection = UDPConnection.CreateClient(); _clientApplication = new ClientApplication(clientConnection, _synchronizationData); if (_connectionHandle.IsHost) { _serverApplication = new ServerApplication(UDPConnection.CreateServer(), _localSession); _serverApplication.matchCreated += OnSessionStart; _connectionHandle.AddTask(_serverApplication.WaitForClientsToBeReady(), TaskHandle.PRIORITY_NETWORK); } else { _clientApplication.connected += OnSessionStart; } _connectionHandle.AddTask(_clientApplication.NotifyClientIsReady(), TaskHandle.PRIORITY_NETWORK); }
private void Start_(string connectionString, string applicationName) { ServerApplication serverApplication = new ServerApplication(); serverApplication.ApplicationName = applicationName; serverApplication.Modules.Add(new WorkflowDemoModule()); serverApplication.ConnectionString = connectionString; serverApplication.Security = new SecurityComplex <User, Role>( new WorkflowServerAuthentication(new BinaryOperator("UserName", "WorkflowService"))); serverApplication.Setup(); serverApplication.Logon(); IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider; server = new WorkflowServer("http://localhost:46232", objectSpaceProvider, objectSpaceProvider); server.WorkflowDefinitionProvider = new WorkflowVersionedDefinitionProvider <XpoWorkflowDefinition, XpoUserActivityVersion>(objectSpaceProvider, null); server.StartWorkflowListenerService.DelayPeriod = TimeSpan.FromSeconds(5); server.StartWorkflowByRequestService.DelayPeriod = TimeSpan.FromSeconds(5); server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromSeconds(30); server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e) { e.WorkflowInstanceStoreBehavior = null; System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior sqlWorkflowInstanceStoreBehavior = new System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior("Integrated Security=SSPI;Pooling=false;Data Source=.\\SqlExpress;Initial Catalog=SqlWorkflowInstanceStoreDB"); sqlWorkflowInstanceStoreBehavior.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2); e.Host.Description.Behaviors.Add(sqlWorkflowInstanceStoreBehavior); e.WorkflowIdleBehavior.TimeToPersist = TimeSpan.FromSeconds(1); //e.WorkflowInstanceStoreBehavior.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2); }; server.CustomHandleException += delegate(object sender, CustomHandleServiceExceptionEventArgs e) { Tracing.Tracer.LogError(e.Exception); if (OnCustomHandleException_ != null) { OnCustomHandleException_(this, new ExceptionEventArgs("Exception occurs:\r\n\r\n" + e.Exception.Message + "\r\n\r\n'" + e.Service.GetType() + "' service")); } e.Handled = true; }; server.Start(); }
private void Start_(string connectionString, string applicationName) { var serverApplication = new ServerApplication(); serverApplication.Modules.Add(new WorkflowDemoWindowsFormsModule()); serverApplication.ApplicationName = applicationName; serverApplication.ConnectionString = connectionString; serverApplication.Security = new SecurityComplex<User, Role>( new WorkflowServerAuthentication(new BinaryOperator("UserName", "WorkflowService"))); serverApplication.Setup(); serverApplication.Logon(); IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider; server = new XpandWorkflowServer("http://localhost:46232", objectSpaceProvider, objectSpaceProvider); server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e) { // // SqlWorkflowInstanceStoreBehavior // //e.WorkflowInstanceStoreBehavior = null; //System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior sqlWorkflowInstanceStoreBehavior = new System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior("Integrated Security=SSPI;Pooling=false;Data Source=(local);Initial Catalog=WorkflowsStore"); //sqlWorkflowInstanceStoreBehavior.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2); //e.Host.Description.Behaviors.Add(sqlWorkflowInstanceStoreBehavior); //e.WorkflowIdleBehavior.TimeToPersist = TimeSpan.FromSeconds(1); e.WorkflowInstanceStoreBehavior.WorkflowInstanceStore.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2); }; server.WorkflowDefinitionProvider = new XpandWorkflowDefinitionProvider(typeof(XpoWorkflowDefinition), new List<Type> { typeof(ScheduledWorkflow), typeof(ObjectChangedWorkflow) }); server.StartWorkflowListenerService.DelayPeriod = TimeSpan.FromSeconds(5); server.StartWorkflowByRequestService.DelayPeriod = TimeSpan.FromSeconds(5); server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromSeconds(60); server.CustomHandleException += delegate(object sender, CustomHandleServiceExceptionEventArgs e) { Tracing.Tracer.LogError(e.Exception); if(OnCustomHandleException_ != null) { OnCustomHandleException_(this, new ExceptionEventArgs("Exception occurs:\r\n\r\n" + e.Exception.Message + "\r\n\r\n'" + e.Service.GetType() + "' service")); } e.Handled = true; }; server.Start(); }
private static PaoApplication CreateApplication() { var app = new ServerApplication() { EventProcessorList = new List <PAO.Ref <BaseEventProcessor> >() .Append(DebugLogger.Default.ToRef()), DataService = CreateDataService().ToRef(), ServerList = new List <PAO.Ref <PAO.Server.BaseServer> >() .Append(new RemoteTcpServer() { Port = 7990, ServiceList = new Dictionary <string, Ref <PaoObject> >() .Append("SecurityService", new SecurityService() { DataService = new AddonFactory <DataService>("DataService") }.ToRef()) .Append("DateTimeService", new DateTimeService().ToRef()) .Append("DataService", new AddonFactory <PaoObject>("DataService")), }.ToRef()), }; return(app); }
protected override void OnStopRequested() { ServerApplication.TearDown(); base.OnStopRequested(); }
protected override void TearDown() { ServerApplication.TearDown(); }
static void Main(string[] args) { WcfDataServerHelper.AddKnownType(typeof(ExportPermissionRequest)); try { string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition(); SecurityAdapterHelper.Enable(); ServerApplication serverApplication = new ServerApplication(); serverApplication.ApplicationName = "InsureCore"; serverApplication.CheckCompatibilityType = CheckCompatibilityType.DatabaseSchema; #if DEBUG if (System.Diagnostics.Debugger.IsAttached && serverApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema) { serverApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways; } #endif serverApplication.Modules.BeginInit(); serverApplication.Modules.Add(new DevExpress.ExpressApp.Security.SecurityModule()); serverApplication.Modules.Add(new InsureCore.Module.InsureCoreModule()); serverApplication.Modules.Add(new InsureCore.Module.Win.InsureCoreWindowsFormsModule()); serverApplication.Modules.Add(new InsureCore.Module.Web.InsureCoreAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.AuditTrail.AuditTrailModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Objects.BusinessClassLibraryCustomizationModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.ChartModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.Win.ChartWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.Web.ChartAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.CloneObject.CloneObjectModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ConditionalAppearance.ConditionalAppearanceModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.DashboardsModule() { DashboardDataType = typeof(DevExpress.Persistent.BaseImpl.DashboardData) }); serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.Win.DashboardsWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.Web.DashboardsAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.FileAttachments.Win.FileAttachmentsWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.FileAttachments.Web.FileAttachmentsAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.HtmlPropertyEditor.Win.HtmlPropertyEditorWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.HtmlPropertyEditor.Web.HtmlPropertyEditorAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Kpi.KpiModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Maps.Web.MapsAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Notifications.NotificationsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Notifications.Win.NotificationsWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Notifications.Web.NotificationsAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.PivotChartModuleBase()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.Win.PivotChartWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.Web.PivotChartAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.PivotGridModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.Win.PivotGridWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.Web.PivotGridAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.ReportsModuleV2() { ReportDataType = typeof(DevExpress.Persistent.BaseImpl.ReportDataV2) }); serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.Win.ReportsWindowsFormsModuleV2()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.Web.ReportsAspNetModuleV2()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Scheduler.SchedulerModuleBase()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Scheduler.Win.SchedulerWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Scheduler.Web.SchedulerAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ScriptRecorder.ScriptRecorderModuleBase()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ScriptRecorder.Win.ScriptRecorderWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ScriptRecorder.Web.ScriptRecorderAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.StateMachine.StateMachineModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.TreeListEditorsModuleBase()); serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.Win.TreeListEditorsWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.Web.TreeListEditorsAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.ValidationModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Win.ValidationWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Web.ValidationAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ViewVariantsModule.ViewVariantsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Workflow.WorkflowModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Workflow.Win.WorkflowWindowsFormsModule()); serverApplication.Modules.EndInit(); serverApplication.DatabaseVersionMismatch += new EventHandler <DatabaseVersionMismatchEventArgs>(serverApplication_DatabaseVersionMismatch); serverApplication.CreateCustomObjectSpaceProvider += new EventHandler <CreateCustomObjectSpaceProviderEventArgs>(serverApplication_CreateCustomObjectSpaceProvider); serverApplication.ConnectionString = connectionString; Console.WriteLine("Setup..."); serverApplication.Setup(); Console.WriteLine("CheckCompatibility..."); serverApplication.CheckCompatibility(); serverApplication.Dispose(); Console.WriteLine("Starting server..."); Func <IDataServerSecurity> dataServerSecurityProvider = () => { SecurityStrategyComplex security = new SecurityStrategyComplex(typeof(User), typeof(Role), new AuthenticationStandard()); security.SupportNavigationPermissionsForTypes = false; security.CustomizeRequestProcessors += delegate(object sender, CustomizeRequestProcessorsEventArgs e) { List <IOperationPermission> result = new List <IOperationPermission>(); if (security != null) { User user = security.User as User; if (user != null) { foreach (Role role in user.Roles) { if (role.CanExport) { result.Add(new ExportPermission()); } } } } IPermissionDictionary permissionDictionary = new PermissionDictionary((IEnumerable <IOperationPermission>)result); e.Processors.Add(typeof(ExportPermissionRequest), new ExportPermissionRequestProcessor(permissionDictionary)); }; return(security); }; WcfXafServiceHost serviceHost = new WcfXafServiceHost(connectionString, dataServerSecurityProvider); serviceHost.AddServiceEndpoint(typeof(IWcfXafDataServer), WcfDataServerHelper.CreateNetTcpBinding(), "net.tcp://127.0.0.1:1451/DataServer"); serviceHost.Open(); Console.WriteLine("Server is started. Press Enter to stop."); Console.ReadLine(); Console.WriteLine("Stopping..."); serviceHost.Close(); Console.WriteLine("Server is stopped."); } catch (Exception e) { Console.WriteLine("Exception occurs: " + e.Message); Console.WriteLine("Press Enter to close."); Console.ReadLine(); } }
static void Main(string[] args) { try { string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition(); ServerApplication serverApplication = new ServerApplication(); serverApplication.ApplicationName = "HRM"; serverApplication.CheckCompatibilityType = CheckCompatibilityType.DatabaseSchema; #if DEBUG if (System.Diagnostics.Debugger.IsAttached && serverApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema) { serverApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways; } #endif serverApplication.Modules.BeginInit(); serverApplication.Modules.Add(new DevExpress.ExpressApp.Security.SecurityModule()); serverApplication.Modules.Add(new HRM.Module.HRMModule()); serverApplication.Modules.Add(new HRM.Module.Win.HRMWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.ValidationModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Win.ValidationWindowsFormsModule()); serverApplication.Modules.EndInit(); serverApplication.DatabaseVersionMismatch += new EventHandler <DatabaseVersionMismatchEventArgs>(serverApplication_DatabaseVersionMismatch); serverApplication.CreateCustomObjectSpaceProvider += (s, e) => { e.ObjectSpaceProviders.Add(new XPObjectSpaceProvider(e.ConnectionString, e.Connection)); e.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(serverApplication.TypesInfo, null)); }; serverApplication.ConnectionString = connectionString; Console.WriteLine("Setup..."); serverApplication.Setup(); Console.WriteLine("CheckCompatibility..."); serverApplication.CheckCompatibility(); serverApplication.Dispose(); Console.WriteLine("Starting server..."); Func <IDataServerSecurity> dataServerSecurityProvider = () => { SecurityStrategyComplex security = new SecurityStrategyComplex(typeof(PermissionPolicyUser), typeof(PermissionPolicyRole), new AuthenticationStandard()); security.SupportNavigationPermissionsForTypes = false; security.RegisterXPOAdapterProviders(); return(security); }; WcfXafServiceHost serviceHost = new WcfXafServiceHost(connectionString, dataServerSecurityProvider); serviceHost.AddServiceEndpoint(typeof(IWcfXafDataServer), WcfDataServerHelper.CreateNetTcpBinding(), "net.tcp://127.0.0.1:61784/DataServer"); serviceHost.Open(); Console.WriteLine("Server is started. Press Enter to stop."); Console.ReadLine(); Console.WriteLine("Stopping..."); serviceHost.Close(); Console.WriteLine("Server is stopped."); } catch (Exception e) { Console.WriteLine("Exception occurs: " + e.Message); Console.WriteLine("Press Enter to close."); Console.ReadLine(); } }
static void Main(string[] args) { try { string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition(); SecurityAdapterHelper.Enable(); ServerApplication serverApplication = new ServerApplication(); serverApplication.ApplicationName = "P3TEK"; serverApplication.CheckCompatibilityType = CheckCompatibilityType.DatabaseSchema; #if DEBUG if (System.Diagnostics.Debugger.IsAttached && serverApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema) { serverApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways; } #endif serverApplication.Modules.BeginInit(); serverApplication.Modules.Add(new DevExpress.ExpressApp.Security.SecurityModule()); serverApplication.Modules.Add(new P3TEK.Module.P3TEKModule()); serverApplication.Modules.Add(new P3TEK.Module.Win.P3TEKWindowsFormsModule()); serverApplication.Modules.Add(new P3TEK.Module.Web.P3TEKAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.AuditTrail.AuditTrailModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Objects.BusinessClassLibraryCustomizationModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.ChartModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.Win.ChartWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.Web.ChartAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.CloneObject.CloneObjectModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ConditionalAppearance.ConditionalAppearanceModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.DashboardsModule() { DashboardDataType = typeof(DevExpress.Persistent.BaseImpl.DashboardData) }); serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.Win.DashboardsWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.Web.DashboardsAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.FileAttachments.Win.FileAttachmentsWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.FileAttachments.Web.FileAttachmentsAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.HtmlPropertyEditor.Win.HtmlPropertyEditorWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.HtmlPropertyEditor.Web.HtmlPropertyEditorAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Kpi.KpiModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.PivotChartModuleBase()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.Win.PivotChartWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.Web.PivotChartAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.PivotGridModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.Win.PivotGridWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.Web.PivotGridAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.ReportsModuleV2() { ReportDataType = typeof(DevExpress.Persistent.BaseImpl.ReportDataV2) }); serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.Win.ReportsWindowsFormsModuleV2()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.Web.ReportsAspNetModuleV2()); serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.TreeListEditorsModuleBase()); serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.Win.TreeListEditorsWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.Web.TreeListEditorsAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.ValidationModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Win.ValidationWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Web.ValidationAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ViewVariantsModule.ViewVariantsModule()); serverApplication.Modules.EndInit(); serverApplication.DatabaseVersionMismatch += new EventHandler <DatabaseVersionMismatchEventArgs>(serverApplication_DatabaseVersionMismatch); serverApplication.CreateCustomObjectSpaceProvider += (s, e) => { e.ObjectSpaceProviders.Add(new XPObjectSpaceProvider(e.ConnectionString, e.Connection)); e.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(serverApplication.TypesInfo, null)); }; serverApplication.ConnectionString = connectionString; Console.WriteLine("Setup..."); serverApplication.Setup(); Console.WriteLine("CheckCompatibility..."); serverApplication.CheckCompatibility(); serverApplication.Dispose(); Console.WriteLine("Starting server..."); Func <IDataServerSecurity> dataServerSecurityProvider = () => { SecurityStrategyComplex security = new SecurityStrategyComplex(typeof(PermissionPolicyUser), typeof(PermissionPolicyRole), new AuthenticationStandard()); security.SupportNavigationPermissionsForTypes = false; return(security); }; WcfXafServiceHost serviceHost = new WcfXafServiceHost(connectionString, dataServerSecurityProvider); serviceHost.AddServiceEndpoint(typeof(IWcfXafDataServer), WcfDataServerHelper.CreateNetTcpBinding(), "net.tcp://127.0.0.1:1451/DataServer"); serviceHost.Open(); Console.WriteLine("Server is started. Press Enter to stop."); Console.ReadLine(); Console.WriteLine("Stopping..."); serviceHost.Close(); Console.WriteLine("Server is stopped."); } catch (Exception e) { Console.WriteLine("Exception occurs: " + e.Message); Console.WriteLine("Press Enter to close."); Console.ReadLine(); } }
private void Start_(string connectionString, string applicationName) { ServerApplication serverApplication = new ServerApplication(); serverApplication.ApplicationName = applicationName; serverApplication.Modules.Add(new WorkflowDemoModule()); serverApplication.ConnectionString = connectionString; serverApplication.Setup(); serverApplication.Logon(); IObjectSpaceProvider objectSpaceProvider = serverApplication.ObjectSpaceProvider; server = new WorkflowServer("http://localhost:46232", objectSpaceProvider, objectSpaceProvider); server.WorkflowDefinitionProvider = new WorkflowVersionedDefinitionProvider<XpoWorkflowDefinition, XpoUserActivityVersion>(objectSpaceProvider, null); server.StartWorkflowListenerService.DelayPeriod = TimeSpan.FromSeconds(5); server.StartWorkflowByRequestService.DelayPeriod = TimeSpan.FromSeconds(5); server.RefreshWorkflowDefinitionsService.DelayPeriod = TimeSpan.FromSeconds(600); server.CustomizeHost += delegate(object sender, CustomizeHostEventArgs e) { // NOTE: Uncomment this section to use alternative workflow configuration. // // SqlWorkflowInstanceStoreBehavior // //e.WorkflowInstanceStoreBehavior = null; //System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior sqlWorkflowInstanceStoreBehavior = new System.ServiceModel.Activities.Description.SqlWorkflowInstanceStoreBehavior("Integrated Security=SSPI;Pooling=false;Data Source=(local);Initial Catalog=WorkflowsStore"); //sqlWorkflowInstanceStoreBehavior.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2); //e.Host.Description.Behaviors.Add(sqlWorkflowInstanceStoreBehavior); //e.WorkflowIdleBehavior.TimeToPersist = TimeSpan.FromSeconds(1); //e.WorkflowIdleBehavior.TimeToPersist = TimeSpan.FromSeconds(10); //e.WorkflowIdleBehavior.TimeToUnload = TimeSpan.FromSeconds(10); e.WorkflowInstanceStoreBehavior.WorkflowInstanceStore.RunnableInstancesDetectionPeriod = TimeSpan.FromSeconds(2); }; server.CustomHandleException += delegate(object sender, CustomHandleServiceExceptionEventArgs e) { Tracing.Tracer.LogError(e.Exception); if(OnCustomHandleException_ != null) { OnCustomHandleException_(this, new ExceptionEventArgs("Exception occurs:\r\n\r\n" + e.Exception.Message + "\r\n\r\n'" + e.Service.GetType() + "' service")); } e.Handled = true; }; server.Start(); }
static void Main(string[] args) { try { string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition(); ServerApplication serverApplication = new ServerApplication(); serverApplication.ApplicationName = "BPIWABK"; serverApplication.CheckCompatibilityType = CheckCompatibilityType.DatabaseSchema; if (System.Diagnostics.Debugger.IsAttached && serverApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema) { serverApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways; } serverApplication.Modules.BeginInit(); serverApplication.Modules.Add(new DevExpress.ExpressApp.Security.SecurityModule()); serverApplication.Modules.Add(new BPIWABK.Module.BPIWABKModule()); serverApplication.Modules.Add(new BPIWABK.Module.Win.BPIWABKWindowsFormsModule()); serverApplication.Modules.Add(new BPIWABK.Module.Web.BPIWABKAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.AuditTrail.AuditTrailModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Objects.BusinessClassLibraryCustomizationModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.ChartModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.Win.ChartWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Chart.Web.ChartAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.CloneObject.CloneObjectModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ConditionalAppearance.ConditionalAppearanceModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.DashboardsModule() { DashboardDataType = typeof(DevExpress.Persistent.BaseImpl.DashboardData) }); serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.Win.DashboardsWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.Web.DashboardsAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.FileAttachments.Win.FileAttachmentsWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.FileAttachments.Web.FileAttachmentsAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.HtmlPropertyEditor.Win.HtmlPropertyEditorWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.HtmlPropertyEditor.Web.HtmlPropertyEditorAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.PivotChartModuleBase()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.Win.PivotChartWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotChart.Web.PivotChartAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.PivotGridModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.Win.PivotGridWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.PivotGrid.Web.PivotGridAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.ReportsModuleV2() { ReportDataType = typeof(DevExpress.Persistent.BaseImpl.ReportDataV2) }); serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.Win.ReportsWindowsFormsModuleV2()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.Web.ReportsAspNetModuleV2()); serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.TreeListEditorsModuleBase()); serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.Win.TreeListEditorsWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.TreeListEditors.Web.TreeListEditorsAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.ValidationModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Win.ValidationWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Web.ValidationAspNetModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ViewVariantsModule.ViewVariantsModule()); serverApplication.Modules.EndInit(); serverApplication.DatabaseVersionMismatch += new EventHandler <DatabaseVersionMismatchEventArgs>(serverApplication_DatabaseVersionMismatch); serverApplication.CreateCustomObjectSpaceProvider += new EventHandler <CreateCustomObjectSpaceProviderEventArgs>(serverApplication_CreateCustomObjectSpaceProvider); serverApplication.ConnectionString = connectionString; Console.WriteLine("Mempersiapkan..."); serverApplication.Setup(); Console.WriteLine("Memeriksa kompatibilitas..."); serverApplication.CheckCompatibility(); serverApplication.Dispose(); WcfDataServerHelper.AddKnownType(typeof(ExportPermissionRequest)); Console.WriteLine("Memulai layanan..."); //ServerPermissionPolicyRequestProcessor.UseAutoAssociationPermission = true; QueryRequestSecurityStrategyHandler securityProviderHandler = delegate() { SecurityStrategyComplex security = new SecurityStrategyComplex( typeof(Pegawai), typeof(Peran), new AuthenticationStandard()); security.CustomizeRequestProcessors += delegate(object sender, CustomizeRequestProcessorsEventArgs e) { List <IOperationPermission> result = new List <IOperationPermission>(); if (security != null) { Pegawai user = security.User as Pegawai; if (user != null) { foreach (Peran role in user.Roles) { if (role.CanExport) { result.Add(new ExportPermission()); } } } } IPermissionDictionary permissionDictionary = new PermissionDictionary((IEnumerable <IOperationPermission>)result); e.Processors.Add(typeof(ExportPermissionRequest), new ExportPermissionRequestProcessor(permissionDictionary)); }; return(security); }; SecuredDataServer dataServer = new SecuredDataServer(connectionString, XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary, securityProviderHandler); RemoteSecuredDataServer.Initialize(dataServer); //"Authentication with the TCP Channel" at http://msdn.microsoft.com/en-us/library/59hafwyt(v=vs.80).aspx IDictionary t = new Hashtable(); t.Add("port", 8082); //t.Add("secure", true); //t.Add("impersonate", false); if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["Test"]) == false) { Console.WriteLine("Test"); } TcpChannel channel = new TcpChannel(t, null, null); ChannelServices.RegisterChannel(channel, true); RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemoteSecuredDataServer), "DataServer", WellKnownObjectMode.Singleton); Console.WriteLine("Layanan telah dimulai..."); Console.WriteLine(""); Console.WriteLine("PERINGATAN: aplikasi Analisis Beban Kerja tidak dapat digunakan apabila layanan di hentikan!"); Console.WriteLine("Apabila layanan telah di hentikan, jalankan BPIWABK.Console.exe untuk kembali memulai layanan."); Console.WriteLine("Tekan tombol Enter untuk menghentikan layanan."); Console.ReadLine(); Console.WriteLine("Menghetikan..."); ChannelServices.UnregisterChannel(channel); Console.WriteLine("Layanan telah dihentikan."); } catch (Exception e) { Console.WriteLine("Kesalahan terjadi: " + e.Message); Console.WriteLine("Tekan tombol Enter untuk menutup."); Console.ReadLine(); } }
internal CICD( CdkStack stack, CfnParameter targetPlatform, LoadBalancedInstancesResult frontEndInstanceInfo, LoadBalancedInstancesResult restAPIInstanceInfo) { var artifactBucket = new Bucket(stack, "ArtifactBucket"); var repo = new Repository(stack, "ApplicationRepository", new RepositoryProps { RepositoryName = stack.StackName, Description = $"Contains the code for the {stack.StackName} application." }); var cfnRepo = repo.Node.DefaultChild as Amazon.CDK.AWS.CodeCommit.CfnRepository; cfnRepo.Code = new CfnRepository.CodeProperty { S3 = new CfnRepository.S3Property { Bucket = SourceBucketName, Key = SourceBucketKey } }; var build = new PipelineProject(stack, "ApplicationBuild", new PipelineProjectProps { Environment = new BuildEnvironment { BuildImage = LinuxBuildImage.AMAZON_LINUX_2_3, EnvironmentVariables = new Dictionary <string, IBuildEnvironmentVariable> { { "TARGET_OS", new BuildEnvironmentVariable { Type = BuildEnvironmentVariableType.PLAINTEXT, Value = targetPlatform.Value } } } } }); var frontEndApplication = new ServerApplication(stack, "FrontEnd", new ServerApplicationProps { ApplicationName = $"{stack.StackName}-FrontEnd" }); var frontEndDeploymentGroup = new ServerDeploymentGroup(stack, "FrontEndDeploymentGroup", new ServerDeploymentGroupProps { Application = frontEndApplication, DeploymentGroupName = $"{stack.StackName.ToLower()}-frontend-deployment-group", //Role = new Role(stack, "DeploymentServiceRole", new RoleProps //{ // AssumedBy = new ServicePrincipal("codedeploy.amazonaws.com"), // Description = "Allows Application Deployment.", // ManagedPolicies = new[] { ManagedPolicy.FromAwsManagedPolicyName("service-role/AWSCodeDeployRole") } //}), //AutoRollback = new AutoRollbackConfig { FailedDeployment = true }, //DeploymentConfig = ServerDeploymentConfig.HALF_AT_A_TIME, LoadBalancer = LoadBalancer.Application(frontEndInstanceInfo.TargetGroup), AutoScalingGroups = new[] { frontEndInstanceInfo.AutoScalingGroup } }); var restApiApplication = new ServerApplication(stack, "RestAPI", new ServerApplicationProps { ApplicationName = $"{stack.StackName}-RESTAPI" }); var restApiDeploymentGroup = new ServerDeploymentGroup(stack, "RestAPIDeploymentGroup", new ServerDeploymentGroupProps { Application = restApiApplication, DeploymentGroupName = $"{stack.StackName.ToLower()}-restapi-deployment-group", //AutoRollback = new AutoRollbackConfig { FailedDeployment = true }, //DeploymentConfig = ServerDeploymentConfig.HALF_AT_A_TIME, LoadBalancer = LoadBalancer.Application(restAPIInstanceInfo.TargetGroup), AutoScalingGroups = new[] { restAPIInstanceInfo.AutoScalingGroup } }); var sourceOutput = new Artifact_(); var frontEndArtifacts = new Artifact_("FrontEndOutput"); var restAPIArtifacts = new Artifact_("RESTAPIOutput"); var pipeline = new Pipeline(stack, "ApplicationPipeline", new PipelineProps { ArtifactBucket = artifactBucket, PipelineName = $"{stack.StackName}-Pipeline", Stages = new[] { new Amazon.CDK.AWS.CodePipeline.StageProps { StageName = "Source", Actions = new [] { new CodeCommitSourceAction(new CodeCommitSourceActionProps { ActionName = "Source", Repository = repo, Output = sourceOutput }) } }, new Amazon.CDK.AWS.CodePipeline.StageProps { StageName = "Build", Actions = new [] { new CodeBuildAction(new CodeBuildActionProps { ActionName = "CodeBuild", Project = build, Input = sourceOutput, Outputs = new [] { frontEndArtifacts, restAPIArtifacts } }) } }, new Amazon.CDK.AWS.CodePipeline.StageProps { StageName = "Deploy", Actions = new [] { new CodeDeployServerDeployAction(new CodeDeployServerDeployActionProps { ActionName = "DeployFrontEnd", DeploymentGroup = frontEndDeploymentGroup, Input = frontEndArtifacts }), new CodeDeployServerDeployAction(new CodeDeployServerDeployActionProps { ActionName = "DeployRESTAPI", DeploymentGroup = restApiDeploymentGroup, Input = restAPIArtifacts }) } } } }); }
public DatabaseCollection(ServerApplication server) { Server = server; UserData = new UserDatabase(); CharacterData = new CharacterDatabase(); }
protected override void OnServerConnectionFailed(int errorCode, string errorMessage, object state) { ServerApplication.OnServerConnectionFailed(errorCode, errorMessage, state); }
private void initXAFServer() { string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition(); SecurityAdapterHelper.Enable(); ServerApplication serverApplication = new ServerApplication(); serverApplication.ApplicationName = "LogXExplorer"; serverApplication.CheckCompatibilityType = CheckCompatibilityType.DatabaseSchema; #if DEBUG if (System.Diagnostics.Debugger.IsAttached && serverApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema) { serverApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways; } #endif serverApplication.Modules.BeginInit(); serverApplication.Modules.Add(new DevExpress.ExpressApp.Security.SecurityModule()); serverApplication.Modules.Add(new LogXExplorer.Module.LogXExplorerModule()); serverApplication.Modules.Add(new LogXExplorer.Module.Win.LogXExplorerWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.AuditTrail.AuditTrailModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Objects.BusinessClassLibraryCustomizationModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.CloneObject.CloneObjectModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ConditionalAppearance.ConditionalAppearanceModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.DashboardsModule() { DashboardDataType = typeof(DevExpress.Persistent.BaseImpl.DashboardData) }); serverApplication.Modules.Add(new DevExpress.ExpressApp.Dashboards.Win.DashboardsWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.FileAttachments.Win.FileAttachmentsWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Notifications.NotificationsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Notifications.Win.NotificationsWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.ReportsModuleV2() { ReportDataType = typeof(DevExpress.Persistent.BaseImpl.ReportDataV2) }); serverApplication.Modules.Add(new DevExpress.ExpressApp.ReportsV2.Win.ReportsWindowsFormsModuleV2()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.ValidationModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Validation.Win.ValidationWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.ViewVariantsModule.ViewVariantsModule()); serverApplication.Modules.EndInit(); serverApplication.DatabaseVersionMismatch += new EventHandler <DatabaseVersionMismatchEventArgs>(serverApplication_DatabaseVersionMismatch); serverApplication.CreateCustomObjectSpaceProvider += (s, e) => { e.ObjectSpaceProviders.Add(new XPObjectSpaceProvider(e.ConnectionString, e.Connection)); e.ObjectSpaceProviders.Add(new NonPersistentObjectSpaceProvider(serverApplication.TypesInfo, null)); }; serverApplication.ConnectionString = connectionString; //System.Console.WriteLine("Setup..."); serverApplication.Setup(); //System.Console.WriteLine("CheckCompatibility..."); serverApplication.CheckCompatibility(); serverApplication.Dispose(); //System.Console.WriteLine("Starting server..."); Func <IDataServerSecurity> dataServerSecurityProvider = () => { SecurityStrategyComplex security = new SecurityStrategyComplex(typeof(PermissionPolicyUser), typeof(PermissionPolicyRole), new AuthenticationStandard()); security.SupportNavigationPermissionsForTypes = false; return(security); }; //+++++ configból a connection stringet: net.tcp://127.0.0.1:1451/DataServer xafServiceHost = new WcfXafServiceHost(connectionString, dataServerSecurityProvider); xafServiceHost.AddServiceEndpoint(typeof(IWcfXafDataServer), WcfDataServerHelper.CreateNetTcpBinding(), "net.tcp://127.0.0.1:1451/DataServer"); xafServiceHost.Open(); System.Console.WriteLine("XAF service inited."); //test ConnectionHelper.Connect(DevExpress.Xpo.DB.AutoCreateOption.DatabaseAndSchema, true); System.Console.WriteLine("ConnectionHelper connected."); }
internal AppdeploymentStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props) { #region Application hosting resources var vpc = new Vpc(this, "appVpc", new VpcProps { MaxAzs = 3 }); var image = new LookupMachineImage(new LookupMachineImageProps { // maps to "Amazon Linux 2 with .NET Core 3.0 and Mono 5.18" Name = "amzn2-ami-hvm-2.0.*-x86_64-gp2-mono-*", Owners = new [] { "amazon" } }); var userData = UserData.ForLinux(); userData.AddCommands(new string[] { "sudo yum install -y httpd", "sudo systemctl start httpd", "sudo systemctl enable httpd" }); var scalingGroup = new AutoScalingGroup(this, "appASG", new AutoScalingGroupProps { Vpc = vpc, InstanceType = InstanceType.Of(InstanceClass.BURSTABLE3, InstanceSize.MEDIUM), MachineImage = image, MinCapacity = 1, MaxCapacity = 4, AllowAllOutbound = true, UserData = userData }); var alb = new ApplicationLoadBalancer(this, "appLB", new ApplicationLoadBalancerProps { Vpc = vpc, InternetFacing = true }); var albListener = alb.AddListener("Port80Listener", new BaseApplicationListenerProps { Port = 80 }); albListener.AddTargets("Port80ListenerTargets", new AddApplicationTargetsProps { Port = 80, Targets = new [] { scalingGroup } }); albListener.Connections.AllowDefaultPortFromAnyIpv4("Open access to port 80"); scalingGroup.ScaleOnRequestCount("ScaleOnModestLoad", new RequestCountScalingProps { TargetRequestsPerSecond = 1 }); #endregion #region CI/CD resources var _sourceOutput = new Artifact_("Source"); var _buildOutput = new Artifact_("Build"); var build = new PipelineProject(this, "CodeBuild", new PipelineProjectProps { // relative path to sample app's file (single html page for now) BuildSpec = BuildSpec.FromSourceFilename("talk-demos/appdeployment/SimplePage/buildspec.yml"), Environment = new BuildEnvironment { BuildImage = LinuxBuildImage.AMAZON_LINUX_2_2 }, }); var appDeployment = new ServerApplication(this, "appDeployment"); // we will use CodeDeploy's default one-at-a-time deployment mode as we are // not specifying a deployment config var deploymentGroup = new ServerDeploymentGroup(this, "appDeploymentGroup", new ServerDeploymentGroupProps { Application = appDeployment, InstallAgent = true, AutoRollback = new AutoRollbackConfig { FailedDeployment = true }, AutoScalingGroups = new [] { scalingGroup } }); // SecretValue.SsmSecure is not currently supported for setting OauthToken, // and haven't gotten the SecretsManager approach to work either so // resorting to keeping my token in an environment var for now! var oauthToken = SecretValue.PlainText(System.Environment.GetEnvironmentVariable("GitHubPersonalToken")); var pipeline = new Pipeline(this, "sampleappPipeline", new PipelineProps { Stages = new StageProps[] { new StageProps { StageName = "Source", Actions = new IAction[] { new GitHubSourceAction(new GitHubSourceActionProps { ActionName = "GitHubSource", Branch = "master", Repo = this.Node.TryGetContext("repo-name").ToString(), Owner = this.Node.TryGetContext("repo-owner").ToString(), OauthToken = oauthToken, Output = _sourceOutput }) } }, new StageProps { StageName = "Build", Actions = new IAction[] { new CodeBuildAction(new CodeBuildActionProps { ActionName = "Build-app", Project = build, Input = _sourceOutput, Outputs = new Artifact_[] { _buildOutput }, RunOrder = 1 }) } }, new StageProps { StageName = "Deploy", Actions = new IAction[] { new CodeDeployServerDeployAction(new CodeDeployServerDeployActionProps { ActionName = "Deploy-app", Input = _buildOutput, RunOrder = 2, DeploymentGroup = deploymentGroup }) } } } }); #endregion }
static void Main(string[] args) { try { ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition(); InMemoryDataStoreProvider.Register(); string connectionString = InMemoryDataStoreProvider.ConnectionString; Console.WriteLine("Starting..."); ServerApplication serverApplication = new ServerApplication(); // Change the ServerApplication.ApplicationName property value. It should be the same as your client application name. serverApplication.ApplicationName = "SecuredExportExample"; // Add your client application's modules to the ServerApplication.Modules collection here. serverApplication.Modules.BeginInit(); serverApplication.Modules.Add(new DevExpress.ExpressApp.Win.SystemModule.SystemWindowsFormsModule()); serverApplication.Modules.Add(new DevExpress.ExpressApp.Security.SecurityModule()); serverApplication.Modules.Add(new SecuredExportExample.Module.SecuredExportExampleModule()); serverApplication.Modules.EndInit(); serverApplication.DatabaseVersionMismatch += new EventHandler <DatabaseVersionMismatchEventArgs>(serverApplication_DatabaseVersionMismatch); serverApplication.CreateCustomObjectSpaceProvider += new EventHandler <CreateCustomObjectSpaceProviderEventArgs>(serverApplication_CreateCustomObjectSpaceProvider); serverApplication.ConnectionString = connectionString; Console.WriteLine("Setup..."); serverApplication.Setup(); Console.WriteLine("CheckCompatibility..."); serverApplication.CheckCompatibility(); serverApplication.Dispose(); Console.WriteLine("Starting server..."); Func <IDataServerSecurity> dataServerSecurityProvider = () => { SecurityStrategyComplex security = new SecurityStrategyComplex( typeof(Employee), typeof(ExtendedSecurityRole), new AuthenticationStandard()); security.CustomizeRequestProcessors += delegate(object sender, CustomizeRequestProcessorsEventArgs e) { List <IOperationPermission> result = new List <IOperationPermission>(); if (security != null) { Employee user = security.User as Employee; if (user != null) { foreach (ExtendedSecurityRole role in user.Roles) { if (role.CanExport) { result.Add(new ExportPermission()); } } } } IPermissionDictionary permissionDictionary = new PermissionDictionary((IEnumerable <IOperationPermission>)result); e.Processors.Add(typeof(ExportPermissionRequest), new ExportPermissionRequestProcessor(permissionDictionary)); }; return(security); }; WcfDataServerHelper.AddKnownType(typeof(ExportPermissionRequest)); WcfXafServiceHost serviceHost = new WcfXafServiceHost(connectionString, dataServerSecurityProvider); serviceHost.AddServiceEndpoint(typeof(IWcfXafDataServer), WcfDataServerHelper.CreateNetTcpBinding(), "net.tcp://127.0.0.1:1451/DataServer"); serviceHost.Open(); Console.WriteLine("Server is started. Press Enter to stop."); #if !EASYTEST Console.ReadLine(); #else // 20 seconds is enough to pass all tests: System.Threading.Thread.Sleep(20000); #endif Console.WriteLine("Stopping..."); serviceHost.Close(); Console.WriteLine("Server is stopped."); } catch (Exception e) { Console.WriteLine("Exception occurs: " + e.Message); Console.WriteLine("Press Enter to close."); Console.ReadLine(); } }
public OpcuaServerApi(ServerApplication serverApplication) { _serverApplication = serverApplication; }