Exemple #1
0
        /// <summary>
        /// Start session launcher service
        /// </summary>
        private void StartSessionLauncherService()
        {
            try
            {
                string sessionLauncherAddress = SoaHelper.GetSessionLauncherAddress("localhost");
                this.launcherHost = new ServiceHost(this.sessionLauncher, new Uri(sessionLauncherAddress));
                BindingHelper.ApplyDefaultThrottlingBehavior(this.launcherHost);

#if AZURE_STORAGE_BINDING
                if (SessionLauncherRuntimeConfiguration.OpenAzureStorageListener)
                {
                    this.launcherHost.AddServiceEndpoint(
                        typeof(ISessionLauncher),
                        new TableTransportBinding()
                    {
                        ConnectionString = SessionLauncherRuntimeConfiguration.SessionLauncherStorageConnectionString, TargetPartitionKey = "all"
                    },
                        TelepathyConstants.SessionLauncherAzureTableBindingAddress);
                    TraceHelper.TraceEvent(TraceEventType.Information, "Add session launcher service endpoint {0}", TelepathyConstants.SessionLauncherAzureTableBindingAddress);
                }
#endif

                if (SessionLauncherRuntimeConfiguration.SchedulerType == SchedulerType.HpcPack)
                {
                    this.launcherHost.AddServiceEndpoint(typeof(ISessionLauncher), BindingHelper.HardCodedSessionLauncherNetTcpBinding, string.Empty);
                    this.launcherHost.AddServiceEndpoint(typeof(ISessionLauncher), BindingHelper.HardCodedNoAuthSessionLauncherNetTcpBinding, "AAD");
                    this.launcherHost.AddServiceEndpoint(typeof(ISessionLauncher), BindingHelper.HardCodedInternalSessionLauncherNetTcpBinding, "Internal");

                    TraceHelper.TraceEvent(TraceEventType.Information, "Open session launcher find cert {0}", TelepathyContext.Get().GetSSLThumbprint().GetAwaiter().GetResult());
                    this.launcherHost.Credentials.UseInternalAuthenticationAsync().GetAwaiter().GetResult();

                    TraceHelper.TraceEvent(TraceEventType.Information, "Add session launcher service endpoint {0}", sessionLauncherAddress);
                }
                else
                {
                    this.launcherHost.AddServiceEndpoint(typeof(ISessionLauncher), BindingHelper.HardCodedUnSecureNetTcpBinding, string.Empty);
                    this.launcherHost.AddServiceEndpoint(typeof(ISessionLauncher), BindingHelper.HardCodedUnSecureNetTcpBinding, "Internal");

                    TraceHelper.TraceEvent(TraceEventType.Information, "Add session launcher service endpoint {0}", sessionLauncherAddress);
                }

                this.launcherHost.Faulted += this.SessionLauncherHostFaultHandler;
                ServiceAuthorizationBehavior myServiceBehavior =
                    this.launcherHost.Description.Behaviors.Find <ServiceAuthorizationBehavior>();
                myServiceBehavior.PrincipalPermissionMode = PrincipalPermissionMode.None;
                this.launcherHost.Open();
                TraceHelper.TraceEvent(TraceEventType.Information, "Open session launcher service");
            }
            catch (Exception ex)
            {
                Trace.TraceError(ex.ToString());
                throw;
            }
        }
Exemple #2
0
 /// <summary>
 /// Get the endpoint Uri for session launcher
 /// </summary>
 /// <param name="headnode">the headnode name</param>
 /// <param name="binding">indicating the binding</param>
 /// <param name="useInternalChannel">If connect to Session Launcher via internal channel</param>
 /// <returns>the SessionLauncher EPR</returns>
 public static Uri GetSessionLauncher(string headnode, Binding binding, bool useInternalChannel)
 {
     if (LocalSession.LocalBroker)
     {
         return(new Uri(SessionLauncherNetPipeAddress));
     }
     else
     {
         return(new Uri((useInternalChannel || SoaHelper.IsCurrentUserLocal()) ? SoaHelper.GetSessionLauncherInternalAddress(headnode, binding) : SoaHelper.GetSessionLauncherAddress(headnode, binding)));
     }
 }