public static MonoscapeServiceHost CreateHost(Type serviceType) { var host = new MonoscapeServiceHost(serviceType); EnableDebugging(host); return(host); }
public static MonoscapeServiceHost CreateFileServerHost(Type serviceType, string httpAddress, string tcpAddress, string pipeAddress) { Uri httpUri = new Uri(httpAddress); Uri tcpUri = new Uri(tcpAddress); Uri pipeUri = new Uri(pipeAddress); Uri[] uriArray = new Uri[] { httpUri, tcpUri, pipeUri }; var serviceHost = new MonoscapeServiceHost(serviceType, uriArray); EnableDebugging (serviceHost); return serviceHost; }
public static MonoscapeServiceHost CreateFileServerHost(Type serviceType, string httpAddress, string tcpAddress, string pipeAddress) { Uri httpUri = new Uri(httpAddress); Uri tcpUri = new Uri(tcpAddress); Uri pipeUri = new Uri(pipeAddress); Uri[] uriArray = new Uri[] { httpUri, tcpUri, pipeUri }; var serviceHost = new MonoscapeServiceHost(serviceType, uriArray); EnableDebugging(serviceHost); return(serviceHost); }
static void EnableDebugging(MonoscapeServiceHost host) { // Enable IncludeExceptionDetailInFaults ServiceDebugBehavior debug = host.Description.Behaviors.Find <ServiceDebugBehavior>(); if (debug == null) { host.Description.Behaviors.Add(new ServiceDebugBehavior() { IncludeExceptionDetailInFaults = true }); } else { if (!debug.IncludeExceptionDetailInFaults) { debug.IncludeExceptionDetailInFaults = true; } } }
private void StartNodeControllerService() { try { nodeControllerHost = MonoscapeServiceHost.CreateHost(typeof(ApNodeControllerService)); var binding = MonoscapeServiceHost.GetBinding(); nodeControllerHost.AddServiceEndpoint(typeof(IApNodeControllerService), binding, Settings.NodeControllerServiceURL); nodeControllerHost.Open(); Console.WriteLine("Node Controller service started at: " + Settings.NodeControllerServiceURL); } catch (CommunicationException ex) { if (nodeControllerHost != null) nodeControllerHost.Abort(); throw new MonoscapeException("Could not start service host: ApNodeControllerService", ex); } catch (TimeoutException ex) { if (nodeControllerHost != null) nodeControllerHost.Abort(); throw new MonoscapeException("Could not start service host: ApNodeControllerService", ex); } catch (Exception) { if (nodeControllerHost != null) nodeControllerHost.Abort(); throw; } }
public static MonoscapeServiceHost CreateHost(Type serviceType) { var host = new MonoscapeServiceHost(serviceType); EnableDebugging (host); return host; }
static void EnableDebugging(MonoscapeServiceHost host) { // Enable IncludeExceptionDetailInFaults ServiceDebugBehavior debug = host.Description.Behaviors.Find<ServiceDebugBehavior>(); if (debug == null) host.Description.Behaviors.Add(new ServiceDebugBehavior() { IncludeExceptionDetailInFaults = true }); else { if (!debug.IncludeExceptionDetailInFaults) debug.IncludeExceptionDetailInFaults = true; } }
private void StartApplicationGridService() { try { gridHost = MonoscapeServiceHost.CreateHost(typeof(NcApplicationGridService)); var binding = MonoscapeServiceHost.GetBinding(); gridHost.AddServiceEndpoint(typeof(INcApplicationGridService), binding, Settings.ApplicationGridServiceUrl); gridHost.Open(); Console.WriteLine("Application Grid service started at: " + Settings.ApplicationGridServiceUrl); } catch (CommunicationException ex) { if (gridHost != null) gridHost.Abort(); throw new MonoscapeException("Could not start service host: NcApplicationGridService", ex); } catch (TimeoutException ex) { if (gridHost != null) gridHost.Abort(); throw new MonoscapeException("Could not start service host: NcApplicationGridService", ex); } catch (Exception e) { if (gridHost != null) gridHost.Abort(); throw e; } }
private void StartLoadBalancerWebService() { try { if (loadBalancerWebServiceHost == null) { loadBalancerWebServiceHost = MonoscapeServiceHost.CreateHost(typeof(LbLoadBalancerWebService)); var binding = MonoscapeServiceHost.GetBinding(); loadBalancerWebServiceHost.AddServiceEndpoint(typeof(ILbLoadBalancerWebService), binding, Settings.LbLoadBalancerWebServiceURL); loadBalancerWebServiceHost.Open(); Console.WriteLine("Load Balancer Web service started at: " + Settings.LbLoadBalancerWebServiceURL); } } catch (AddressAlreadyInUseException) { } catch (CommunicationException ex) { if (loadBalancerWebServiceHost != null) loadBalancerWebServiceHost.Abort(); throw new MonoscapeException("Could not start service host: LbApplicationGridService", ex); } catch (TimeoutException ex) { if (loadBalancerWebServiceHost != null) loadBalancerWebServiceHost.Abort(); throw new MonoscapeException("Could not start service host: LbApplicationGridService", ex); } catch (Exception) { if (loadBalancerWebServiceHost != null) loadBalancerWebServiceHost.Abort(); throw; } }
private void StartExternalSystemService() { try { externalSysHost = MonoscapeServiceHost.CreateHost(typeof(ExternalSystemService)); var binding = MonoscapeServiceHost.GetBinding(); externalSysHost.AddServiceEndpoint(typeof(IExternalSystemService), binding, Settings.ExternalSystemServiceURL); externalSysHost.Open(); Console.WriteLine("External system service started at: " + Settings.ExternalSystemServiceURL); } catch (CommunicationException ex) { if (externalSysHost != null) externalSysHost.Abort(); throw new MonoscapeException("Could not start service host: ExternalSystemService", ex); } catch (TimeoutException ex) { if (externalSysHost != null) externalSysHost.Abort(); throw new MonoscapeException("Could not start service host: ExternalSystemService", ex); } catch (Exception) { if (externalSysHost != null) externalSysHost.Abort(); throw; } }
private void StartDashboardService() { try { dashboardHost = MonoscapeServiceHost.CreateHost(typeof(CcDashboardService)); var binding = MonoscapeServiceHost.GetBinding(); dashboardHost.AddServiceEndpoint(typeof(ICcDashboardService), binding, Settings.DashboardServiceURL); dashboardHost.Open(); Console.WriteLine("Dashboard service started at: " + Settings.DashboardServiceURL); } catch (CommunicationException ex) { if (dashboardHost != null) dashboardHost.Abort(); throw new MonoscapeException("Could not start service host: CcDashboardService", ex); } catch (TimeoutException ex) { if (dashboardHost != null) dashboardHost.Abort(); throw new MonoscapeException("Could not start service host: CcDashboardService", ex); } catch (Exception) { if (dashboardHost != null) dashboardHost.Abort(); throw; } }