static void Main() { try { string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString; ValueManager.ValueManagerType = typeof(MultiThreadValueManager <>).GetGenericTypeDefinition(); Console.WriteLine(@"Starting..."); var serverApplication = new ConsoleApplicationServerServerApplication(new SecurityStrategyComplex(typeof(SecuritySystemUser), typeof(SecuritySystemRole), new AuthenticationStandard())) { ConnectionString = connectionString }; Console.WriteLine(@"Setup..."); var worldCreatorTypeInfoSource = WorldCreatorTypeInfoSource.Instance; serverApplication.Setup(); Console.WriteLine(@"CheckCompatibility..."); serverApplication.CheckCompatibility(); XpandWcfDataServerHelper.AddKnownTypesForAll(serverApplication); serverApplication.Dispose(); Console.WriteLine(@"Starting server..."); IDataServerSecurity SecurityProviderHandler() => new SecurityStrategyComplex(typeof(SecuritySystemUser), typeof(SecuritySystemRole), new AuthenticationStandard()); var dataServer = new XpandSecuredDataServer(connectionString, XpoTypesInfoHelper.GetXpoTypeInfoSource().XPDictionary, SecurityProviderHandler); var serviceHost = new ServiceHost(new WcfSecuredDataServer(dataServer)); var defaultBinding = (WSHttpBinding)WcfDataServerHelper.CreateDefaultBinding(); defaultBinding.ReaderQuotas.MaxStringContentLength = 2147483647; serviceHost.AddServiceEndpoint(typeof(IWcfSecuredDataServer), defaultBinding, "http://*****:*****@"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() { #if EASYTEST DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register(); #endif Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); EditModelPermission.AlwaysGranted = Debugger.IsAttached; var winApplication = new SecuritySystemExampleWindowsFormsApplication(); try { winApplication.ConnectionString = "http://localhost:1451/DataServer"; XpandWcfDataServerHelper.AddKnownTypes(); var defaultBinding = (WSHttpBinding)WcfDataServerHelper.CreateDefaultBinding(); defaultBinding.ReaderQuotas.MaxStringContentLength = 2147483647; var clientDataServer = new WcfSecuredDataServerClient( defaultBinding, new EndpointAddress(winApplication.ConnectionString)); var securityClient = new ServerSecurityClient(clientDataServer, new ClientInfoFactory()) { IsSupportChangePassword = true }; winApplication.ApplicationName = "SecuritySystemExample"; winApplication.Security = securityClient; winApplication.CreateCustomObjectSpaceProvider += delegate(object sender, CreateCustomObjectSpaceProviderEventArgs e) { e.ObjectSpaceProvider = new DataServerObjectSpaceProvider(clientDataServer, securityClient); }; winApplication.UseOldTemplates = false; var worldCreatorTypeInfoSource = WorldCreatorTypeInfoSource.Instance; winApplication.Setup(); winApplication.Start(); clientDataServer.Close(); } catch (Exception e) { winApplication.HandleException(e); } }