Changeset 4302 for branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server/3.3/HeuristicLabHiveServerApplication.cs
- Timestamp:
- 08/24/10 15:31:35 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server/3.3/HeuristicLabHiveServerApplication.cs
r4285 r4302 33 33 34 34 namespace HeuristicLab.Hive.Server { 35 [Application("Hive Server", "Server application for the distributed hive engine.", true)]35 [Application("Hive Server", "Server application for the distributed hive engine.", false)] 36 36 public class HeuristicLabHiveServerApplication : ApplicationBase { 37 public const string STR_SlaveCommunicator = "HiveServer";38 public const string STR_ServerConsoleFacade = "ServerConsoleFacade";39 public const string STR_ExecutionEngineFacade = "ExecutionEngineFacade";40 37 Dictionary<string, Uri> baseAddrDict = new Dictionary<string, Uri>(); 41 38 42 39 public override void Run() { 43 ServiceHost slaveHost = new ServiceHost(ApplicationManager.Manager.GetTypes(typeof(ISlaveFacade)).First(), GetUri(STR_SlaveCommunicator)); 44 slaveHost.Open(); 40 ILifecycleManager lifecycleManager = null; 41 ServiceHost slaveServiceHost = null; 42 ServiceHost serverConsoleServiceHost = null; 43 ServiceHost clientServiceHost = null; 44 try { 45 slaveServiceHost = new ServiceHost(ApplicationManager.Manager.GetTypes(typeof(ISlaveFacade)).First(), GetUri(WcfSettings.SlaveServiceName)); 46 slaveServiceHost.Open(); 45 47 46 ServiceHost serverConsoleHost = new ServiceHost(ApplicationManager.Manager.GetTypes(typeof(IServerConsoleFacade)).First(), GetUri(STR_ServerConsoleFacade));47 serverConsoleHost.Open();48 serverConsoleServiceHost = new ServiceHost(ApplicationManager.Manager.GetTypes(typeof(IServerConsoleFacade)).First(), GetUri(WcfSettings.ServerConsoleServiceName)); 49 serverConsoleServiceHost.Open(); 48 50 49 ServiceHost executionEngineHost = new ServiceHost(ApplicationManager.Manager.GetTypes(typeof(IExecutionEngineFacade)).First(), GetUri(STR_ExecutionEngineFacade));50 executionEngineHost.Open();51 clientServiceHost = new ServiceHost(ApplicationManager.Manager.GetTypes(typeof(IClientFacade)).First(), GetUri(WcfSettings.ClientServiceName)); 52 clientServiceHost.Open(); 51 53 52 ILifecycleManagerlifecycleManager = ServiceLocator.GetLifecycleManager();53 lifecycleManager.Init();54 lifecycleManager = ServiceLocator.GetLifecycleManager(); 55 lifecycleManager.Init(); 54 56 55 Form mainForm = new MainForm(baseAddrDict); 56 Application.Run(); 57 Form mainForm = new MainForm(baseAddrDict); 58 Application.Run(); 59 } 60 catch (AddressAccessDeniedException ex) { 61 throw new Exception("Unable to start WCF-Services due to missing rights. Run the following command as administrator: \"netsh http add urlacl url=http://+" + WcfSettings.DefaultPort + "/ user=MYMACHINE\\UserName\". See inner exception for more details.", ex); 62 } 63 finally { 64 if (slaveServiceHost != null && slaveServiceHost.State == CommunicationState.Opened) 65 slaveServiceHost.Close(); 66 if (serverConsoleServiceHost != null && serverConsoleServiceHost.State == CommunicationState.Opened) 67 serverConsoleServiceHost.Close(); 68 if (clientServiceHost != null && clientServiceHost.State == CommunicationState.Opened) 69 clientServiceHost.Close(); 57 70 58 slaveHost.Close(); 59 serverConsoleHost.Close(); 60 executionEngineHost.Close(); 61 62 lifecycleManager.Shutdown(); 71 if(lifecycleManager != null) 72 lifecycleManager.Shutdown(); 73 } 63 74 } 64 75 65 76 private Uri GetUri(string serviceName) { 66 77 string ipAddress = WcfSettings.GetActiveIP().ToString(); 67 string port = WcfSettings.D EFAULTPORT.ToString();78 string port = WcfSettings.DefaultPort.ToString(); 68 79 Uri uriHttp = new Uri("http://" + ipAddress + ":" + port + "/" + serviceName + "/"); 69 80 baseAddrDict.Add(serviceName, uriHttp);
Note: See TracChangeset
for help on using the changeset viewer.