예제 #1
0
        /// <summary>
        /// Apply session id to the uri
        /// </summary>
        /// <param name="baseUri">indicate the base uri</param>
        /// <param name="sessionId">indicate the session id</param>
        /// <param name="postfix">indicate the postfix</param>
        /// <param name="needFqdn">indicate if need FQDN</param>
        /// <returns>uri with session id</returns>
        private static Uri ApplySessionId(Uri baseUri, string sessionId, string postfix, bool needFqdn)
        {
            UriBuilder builder = new UriBuilder(baseUri);

            if (baseUri.IsLoopback)
            {
#if PaaS
                if (SoaHelper.IsOnAzure())
                {
                    builder.Host = AzureRoleHelper.GetLocalMachineAddress();
                }
                else
#endif
                {
                    if (needFqdn)
                    {
                        string domainName = IPGlobalProperties.GetIPGlobalProperties().DomainName;
                        builder.Host = string.Format("{0}.{1}", Environment.MachineName, domainName);
                    }
                    else
                    {
                        builder.Host = Environment.MachineName;
                    }
                }
            }

            return(new Uri(builder.Uri, String.Format(CultureInfo.InvariantCulture, "{0}/{1}", sessionId, postfix)));
        }
예제 #2
0
        /// <summary>
        /// Get the Azure broker nodes' IP addresses and update the address list.
        /// </summary>
        private void UpdateAvailableAzureBroker(object state)
        {
            // throw away the previous list and update the list reference
            this.availableAzureBrokers = AzureRoleHelper.GetAllBrokerAddress();

            TraceHelper.TraceEvent(
                TraceEventType.Verbose,
                "[BrokerNodesManager] .UpdateAvailableAzureBroker: Get {0} brokers", this.availableAzureBrokers.Count);
        }