Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/24/10 15:31:35 (14 years ago)
Author:
cneumuel
Message:
  • made ServerConsole work with wsHttpBinding
  • applied role-base restrictions to all WCF-Services
  • made wcf-services work with certificates
  • renamed ExecutionEngineFacade to ClientFacade

(#1168)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3-HiveMigration/sources/HeuristicLab.Hive/HeuristicLab.Hive.Server/3.3/HeuristicLabHiveServerApplication.cs

    r4285 r4302  
    3333
    3434namespace 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)]
    3636  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";
    4037    Dictionary<string, Uri> baseAddrDict = new Dictionary<string, Uri>();
    4138
    4239    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();
    4547
    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();
    4850
    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();
    5153
    52       ILifecycleManager lifecycleManager = ServiceLocator.GetLifecycleManager();
    53       lifecycleManager.Init();
     54        lifecycleManager = ServiceLocator.GetLifecycleManager();
     55        lifecycleManager.Init();
    5456
    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();
    5770
    58       slaveHost.Close();
    59       serverConsoleHost.Close();
    60       executionEngineHost.Close();
    61 
    62       lifecycleManager.Shutdown();
     71        if(lifecycleManager != null)
     72          lifecycleManager.Shutdown();
     73      }
    6374    }
    6475
    6576    private Uri GetUri(string serviceName) {
    6677      string ipAddress = WcfSettings.GetActiveIP().ToString();
    67       string port = WcfSettings.DEFAULTPORT.ToString();
     78      string port = WcfSettings.DefaultPort.ToString();
    6879      Uri uriHttp = new Uri("http://" + ipAddress + ":" + port + "/" + serviceName + "/");
    6980      baseAddrDict.Add(serviceName, uriHttp);
Note: See TracChangeset for help on using the changeset viewer.