Changeset 753 for trunk/sources
- Timestamp:
- 11/13/08 17:08:57 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Server/HiveServerApplication.cs
r741 r753 26 26 using HeuristicLab.PluginInfrastructure; 27 27 using System.ServiceModel; 28 using System.ServiceModel.Description; 29 using System.Net; 30 using HeuristicLab.Hive.Contracts; 28 31 using HeuristicLab.Hive.Server.Interfaces; 29 32 … … 33 36 AutoRestart = true)] 34 37 class HiveServerApplication : ApplicationBase { 35 36 private bool Startup() { 37 return true; 38 } 38 const int port = 9000; 39 39 40 40 public override void Run() { 41 IPHostEntry IPHost = Dns.GetHostEntry(Dns.GetHostName()); 42 string externalIP = IPHost.AddressList[0].ToString(); 41 43 42 44 DiscoveryService discService = 43 45 new DiscoveryService(); 44 45 46 IClientCommunicator[] instances = 46 47 discService.GetInstances<IClientCommunicator>(); 47 48 48 49 if (instances.Length > 0) { 50 Uri uriTcp = 51 new Uri("net.tcp://" + externalIP + ":" + port +"/HiveServer/"); 52 49 53 ServiceHost serviceHost = 50 new ServiceHost(instances[0].GetType()); 54 new ServiceHost(instances[0].GetType(), 55 uriTcp); 56 57 System.ServiceModel.Channels.Binding binding = 58 new NetTcpBinding(); 59 60 serviceHost.AddServiceEndpoint( 61 typeof(IClientCommunicator), 62 binding, 63 "ClientCommunicator"); 64 65 ServiceMetadataBehavior behavior = 66 new ServiceMetadataBehavior(); 67 serviceHost.Description.Behaviors.Add(behavior); 68 69 serviceHost.AddServiceEndpoint( 70 typeof(IMetadataExchange), 71 MetadataExchangeBindings.CreateMexTcpBinding(), 72 "mex"); 51 73 52 74 serviceHost.Open();
Note: See TracChangeset
for help on using the changeset viewer.