private static Uri GetFrontEndHttpServiceUrl <ServiceType>(IExchangePrincipal exchangePrincipal) where ServiceType : HttpService { if (exchangePrincipal == null) { throw new ArgumentNullException("exchangePrincipal"); } if (exchangePrincipal.MailboxInfo.Location.ServerVersion >= Server.E15MinVersion && FrontEndLocator.IsDatacenter) { return(GlobalServiceUrls.GetExternalUrl <ServiceType>()); } ServiceTopology serviceTopology = FrontEndLocator.IsDatacenter ? ServiceTopology.GetCurrentLegacyServiceTopology("f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\Cafe\\FrontEndLocator.cs", "GetFrontEndHttpServiceUrl", 276) : ServiceTopology.GetCurrentServiceTopology("f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\Cafe\\FrontEndLocator.cs", "GetFrontEndHttpServiceUrl", 276); ServerVersion serverVersion = new ServerVersion(exchangePrincipal.MailboxInfo.Location.ServerVersion); int majorversion = serverVersion.Major; IList <ServiceType> services = serviceTopology.FindAll <ServiceType>(exchangePrincipal, ClientAccessType.External, (ServiceType service) => new ServerVersion(service.ServerVersionNumber).Major == majorversion, "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\Cafe\\FrontEndLocator.cs", "GetFrontEndHttpServiceUrl", 281); Uri uri = FrontEndLocator.FindServiceInList <ServiceType>(services); if (uri == null) { services = serviceTopology.FindAll <ServiceType>(exchangePrincipal, ClientAccessType.Internal, (ServiceType service) => new ServerVersion(service.ServerVersionNumber).Major == majorversion, "f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\Cafe\\FrontEndLocator.cs", "GetFrontEndHttpServiceUrl", 285); uri = FrontEndLocator.FindServiceInList <ServiceType>(services); } if (uri != null) { ExTraceGlobals.CafeTracer.TraceDebug <string>(0L, "[FrontEndLocator.GetFrontEndHttpServiceUrl] Found HTTP service for the specified back end server {0}.", exchangePrincipal.MailboxInfo.Location.ServerFqdn); return(uri); } throw new ServerNotFoundException("Unable to find proper HTTP service."); }
private string GetEnterpriseOrE14OwaServiceUrl(IExchangePrincipal exchangePrincipal) { ServiceTopology serviceTopology = this.IsMultitenancyEnabled ? ServiceTopology.GetCurrentLegacyServiceTopology("f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\StoreTasks\\UserOptions\\MailboxCalendarFolder\\SetMailboxCalendarFolder.cs", "GetEnterpriseOrE14OwaServiceUrl", 335) : ServiceTopology.GetCurrentServiceTopology("f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\StoreTasks\\UserOptions\\MailboxCalendarFolder\\SetMailboxCalendarFolder.cs", "GetEnterpriseOrE14OwaServiceUrl", 335); IList <OwaService> list = serviceTopology.FindAll <OwaService>(exchangePrincipal, ClientAccessType.External, SetMailboxCalendarFolder.serviceFilter, "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\StoreTasks\\UserOptions\\MailboxCalendarFolder\\SetMailboxCalendarFolder.cs", "GetEnterpriseOrE14OwaServiceUrl", 339); if (list.Count != 0) { return(list[0].Url.ToString()); } OwaService owaService = serviceTopology.FindAny <OwaService>(ClientAccessType.External, SetMailboxCalendarFolder.serviceFilter, "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\StoreTasks\\UserOptions\\MailboxCalendarFolder\\SetMailboxCalendarFolder.cs", "GetEnterpriseOrE14OwaServiceUrl", 348); if (owaService == null) { throw new NoExternalOwaAvailableException(); } return(owaService.Url.ToString()); }
public BackEndServer GetDownLevelClientAccessServer <ServiceType>(AnchorMailbox anchorMailbox, BackEndServer mailboxServer, ClientAccessType clientAccessType, RequestDetailsLogger logger, bool calculateRedirectUrl, out Uri redirectUrl) where ServiceType : HttpService { if (anchorMailbox == null) { throw new ArgumentNullException("anchorMailbox"); } if (mailboxServer == null) { throw new ArgumentNullException("mailboxServer"); } if (logger == null) { throw new ArgumentNullException("logger"); } if (!DownLevelServerManager.IsApplicable) { throw new HttpProxyException(HttpStatusCode.NotFound, HttpProxySubErrorCode.EndpointNotFound, string.Format("{0} does not support down level server proxy.", HttpProxyGlobals.ProtocolType)); } redirectUrl = null; if (mailboxServer.Version < Server.E14MinVersion) { ExTraceGlobals.VerboseTracer.TraceDebug <int, int, string>((long)this.GetHashCode(), "[DownLevelServerManager::GetDownLevelClientAccessServer]: Found mailbox server version {0}, which was pre-E14 minimum version {1}, so returning mailbox server FQDN {2}", mailboxServer.Version, Server.E14MinVersion, mailboxServer.Fqdn); return(mailboxServer); } ServiceTopology currentLegacyServiceTopology = ServiceTopology.GetCurrentLegacyServiceTopology("f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\DownLevelServerManager\\DownLevelServerManager.cs", "GetDownLevelClientAccessServer", 393); Site site = currentLegacyServiceTopology.GetSite(mailboxServer.Fqdn, "f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\DownLevelServerManager\\DownLevelServerManager.cs", "GetDownLevelClientAccessServer", 394); ServiceType result = this.GetClientAccessServiceInSite <ServiceType>(currentLegacyServiceTopology, anchorMailbox, site, clientAccessType, (ServiceType service) => service.ServerVersionNumber >= Server.E14MinVersion && service.ServerVersionNumber < Server.E15MinVersion, logger); if (calculateRedirectUrl && !Utilities.IsPartnerHostedOnly && !VariantConfiguration.InvariantNoFlightingSnapshot.Cafe.NoCrossSiteRedirect.Enabled && result != null && !string.IsNullOrEmpty(result.ServerFullyQualifiedDomainName)) { Site member = HttpProxyGlobals.LocalSite.Member; if (!member.DistinguishedName.Equals(result.Site.DistinguishedName)) { HttpService httpService = currentLegacyServiceTopology.FindAny <ServiceType>(ClientAccessType.External, (ServiceType externalService) => externalService != null && externalService.ServerFullyQualifiedDomainName.Equals(result.ServerFullyQualifiedDomainName, StringComparison.OrdinalIgnoreCase), "f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\DownLevelServerManager\\DownLevelServerManager.cs", "GetDownLevelClientAccessServer", 419); if (httpService != null) { redirectUrl = httpService.Url; } } } return(new BackEndServer(result.ServerFullyQualifiedDomainName, result.ServerVersionNumber)); }
// Token: 0x060001E7 RID: 487 RVA: 0x000090D8 File Offset: 0x000072D8 public static bool IsServerDiscoverable(string fqdn) { if (string.IsNullOrEmpty(fqdn)) { throw new ArgumentNullException("fqdn"); } try { ServiceTopology.GetCurrentLegacyServiceTopology("d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\DownLevelServerManager\\DownLevelServerManager.cs", "IsServerDiscoverable", 179).GetSite(fqdn, "d:\\dbs\\sh\\e16df\\0212_214120_0\\cmd\\1g\\sources\\Dev\\Cafe\\src\\HttpProxy\\DownLevelServerManager\\DownLevelServerManager.cs", "IsServerDiscoverable", 180); } catch (ServerNotFoundException) { return(false); } catch (ServerNotInSiteException) { return(false); } return(true); }
public static bool IsServerDiscoverable(string fqdn) { if (string.IsNullOrEmpty(fqdn)) { throw new ArgumentNullException("fqdn"); } try { ServiceTopology currentLegacyServiceTopology = ServiceTopology.GetCurrentLegacyServiceTopology("f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\DownLevelServerManager\\DownLevelServerManager.cs", "IsServerDiscoverable", 176); currentLegacyServiceTopology.GetSite(fqdn, "f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\DownLevelServerManager\\DownLevelServerManager.cs", "IsServerDiscoverable", 177); } catch (ServerNotFoundException) { return(false); } catch (ServerNotInSiteException) { return(false); } return(true); }
private Uri GetEcpUrl(ExchangePrincipal mailbox) { Uri uri = null; Exception ex = null; try { if (mailbox.MailboxInfo.Location.ServerVersion >= Server.E15MinVersion && GlobalSettings.IsMultiTenancyEnabled) { uri = FrontEndLocator.GetFrontEndEcpUrl(mailbox); AirSyncDiagnostics.TraceDebug <ExchangePrincipal, Uri>(ExTraceGlobals.RequestsTracer, null, "ABQMail:ECP URL for user {0} - {1} (E15 Multitenancy)", mailbox, uri); } else { ServiceTopology serviceTopology = GlobalSettings.IsMultiTenancyEnabled ? ServiceTopology.GetCurrentLegacyServiceTopology("f:\\15.00.1497\\sources\\dev\\AirSync\\src\\AirSync\\ABQMailHelper.cs", "GetEcpUrl", 605) : ServiceTopology.GetCurrentServiceTopology("f:\\15.00.1497\\sources\\dev\\AirSync\\src\\AirSync\\ABQMailHelper.cs", "GetEcpUrl", 605); ServerVersion serverVersion = new ServerVersion(mailbox.MailboxInfo.Location.ServerVersion); int majorversion = serverVersion.Major; IList <EcpService> list = serviceTopology.FindAll <EcpService>(mailbox, ClientAccessType.External, (EcpService service) => new ServerVersion(service.ServerVersionNumber).Major == majorversion, "f:\\15.00.1497\\sources\\dev\\AirSync\\src\\AirSync\\ABQMailHelper.cs", "GetEcpUrl", 610); foreach (EcpService ecpService in list) { if (ecpService != null && ecpService.Url != null) { uri = ecpService.Url; AirSyncDiagnostics.TraceDebug <ExchangePrincipal, Uri>(ExTraceGlobals.RequestsTracer, null, "ABQMail:ECP URL for user {0} - {1} (not E15 Multitenancy)", mailbox, uri); break; } } } } catch (ServerNotFoundException ex2) { ex = ex2; } catch (ADTransientException ex3) { ex = ex3; } catch (DataSourceOperationException ex4) { ex = ex4; } catch (DataValidationException ex5) { ex = ex5; } finally { if (ex != null) { AirSyncDiagnostics.TraceError <ExchangePrincipal, Exception>(ExTraceGlobals.RequestsTracer, null, "ABQMail:Could not retrieve ECP URL for user {0} - {1}", mailbox, ex); } } return(uri); }
private AnchorMailbox GetE14CASServer(OABCache.OABCacheEntry oab) { ServiceTopology serviceTopology = ServiceTopology.GetCurrentLegacyServiceTopology("f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\RequestHandlers\\OabProxyRequestHandler.cs", "GetE14CASServer", 287); Site currentSite = HttpProxyGlobals.LocalSite.Member; List <OabService> cheapestCASServers = new List <OabService>(); int cheapestSiteConnectionCost = int.MaxValue; OabProxyRequestHandler.IsEligibleOabService isEligibleOabServiceDelegate = null; if (oab.GlobalWebDistributionEnabled) { isEligibleOabServiceDelegate = new OabProxyRequestHandler.IsEligibleOabService(this.IsEligibleOabServiceBasedOnVersion); } else { if (oab.VirtualDirectories == null || oab.VirtualDirectories.Count <= 0) { ExTraceGlobals.VerboseTracer.TraceError(0L, "[OabProxyRequestHandler::ResolveAnchorMailbox] The OAB is distributed neither globally nor to named vdirs; there is no way to retrieve it"); throw new HttpProxyException(HttpStatusCode.InternalServerError, HttpProxySubErrorCode.ServerNotFound, "The OAB is distributed neither globally nor to named vdirs; there is no way to retrieve it"); } isEligibleOabServiceDelegate = new OabProxyRequestHandler.IsEligibleOabService(this.IsEligibleOabServiceBasedOnVersionAndVirtualDirectory); } serviceTopology.ForEach <OabService>(delegate(OabService oabService) { if (isEligibleOabServiceDelegate(oabService, oab)) { int maxValue = int.MaxValue; if (currentSite != null && oabService.Site != null) { serviceTopology.TryGetConnectionCost(currentSite, oabService.Site, out maxValue, "f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\RequestHandlers\\OabProxyRequestHandler.cs", "GetE14CASServer", 325); } if (maxValue == cheapestSiteConnectionCost) { cheapestCASServers.Add(oabService); return; } if (maxValue < cheapestSiteConnectionCost) { cheapestCASServers.Clear(); cheapestCASServers.Add(oabService); cheapestSiteConnectionCost = maxValue; } } }, "f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\RequestHandlers\\OabProxyRequestHandler.cs", "GetE14CASServer", 316); if (cheapestCASServers.Count == 0) { ExTraceGlobals.VerboseTracer.TraceError(0L, "[OabProxyRequestHandler::ResolveAnchorMailbox] Could not find a valid downlevel CAS server for this OAB"); throw new HttpProxyException(HttpStatusCode.InternalServerError, HttpProxySubErrorCode.ServerNotFound, "Could not find a valid downlevel CAS server for this OAB"); } OabService oabService2; if (cheapestCASServers.Count == 1) { oabService2 = cheapestCASServers[0]; } else { oabService2 = cheapestCASServers[OabProxyRequestHandler.RandomNumberGenerator.Next(cheapestCASServers.Count)]; } BackEndServer backendServer = new BackEndServer(oabService2.ServerFullyQualifiedDomainName, oabService2.ServerVersionNumber); return(new ServerInfoAnchorMailbox(backendServer, this)); }
public BackEndServer GetDownLevelClientAccessServerWithPreferredServer <ServiceType>(AnchorMailbox anchorMailbox, string preferredCasServerFqdn, ClientAccessType clientAccessType, RequestDetailsLogger logger, int destinationVersion) where ServiceType : HttpService { Predicate <ServiceType> predicate = null; Predicate <ServiceType> predicate2 = null; if (anchorMailbox == null) { throw new ArgumentNullException("anchorMailbox"); } if (string.IsNullOrEmpty(preferredCasServerFqdn)) { throw new ArgumentException("preferredCasServerFqdn cannot be empty!"); } ServiceTopology currentLegacyServiceTopology = ServiceTopology.GetCurrentLegacyServiceTopology("f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\DownLevelServerManager\\DownLevelServerManager.cs", "GetDownLevelClientAccessServerWithPreferredServer", 253); Site site = currentLegacyServiceTopology.GetSite(preferredCasServerFqdn, "f:\\15.00.1497\\sources\\dev\\cafe\\src\\HttpProxy\\DownLevelServerManager\\DownLevelServerManager.cs", "GetDownLevelClientAccessServerWithPreferredServer", 254); Dictionary <string, List <DownLevelServerStatusEntry> > downLevelServerMap = this.GetDownLevelServerMap(); List <DownLevelServerStatusEntry> list = null; if (!downLevelServerMap.TryGetValue(site.DistinguishedName, out list)) { string text = string.Format("Unable to find site {0} in the down level server map.", site.DistinguishedName); ExTraceGlobals.VerboseTracer.TraceError <string>((long)this.GetHashCode(), "[DownLevelServerManager::GetDownLevelClientAccessServerWithPreferredServer]: {0}", text); ThreadPool.QueueUserWorkItem(delegate(object o) { this.RefreshServerMap(true); }); throw new NoAvailableDownLevelBackEndException(text); } DownLevelServerStatusEntry downLevelServerStatusEntry = list.Find((DownLevelServerStatusEntry backend) => preferredCasServerFqdn.Equals(backend.BackEndServer.Fqdn, StringComparison.OrdinalIgnoreCase)); if (downLevelServerStatusEntry == null) { string text2 = string.Format("Unable to find preferred server {0} in the back end server map.", preferredCasServerFqdn); ExTraceGlobals.VerboseTracer.TraceError <string>((long)this.GetHashCode(), "[DownLevelServerManager::GetDownLevelClientAccessServerWithPreferredServer]: {0}", text2); throw new NoAvailableDownLevelBackEndException(text2); } if (downLevelServerStatusEntry.IsHealthy) { ExTraceGlobals.VerboseTracer.TraceDebug <DownLevelServerStatusEntry>((long)this.GetHashCode(), "[DownLevelServerManager::GetDownLevelClientAccessServerWithPreferredServer]: The preferred server {0} is healthy.", downLevelServerStatusEntry); return(downLevelServerStatusEntry.BackEndServer); } ServiceType serviceType = default(ServiceType); if (destinationVersion < Server.E14MinVersion) { try { List <DownLevelServerStatusEntry> serverList = list; ServiceTopology topology = currentLegacyServiceTopology; Site targetSite = site; if (predicate == null) { predicate = ((ServiceType service) => service.ServerVersionNumber >= Server.E2007MinVersion && service.ServerVersionNumber < Server.E14MinVersion); } serviceType = this.GetClientAccessServiceFromList <ServiceType>(serverList, topology, anchorMailbox, targetSite, clientAccessType, predicate, logger, DownLevelServerManager.DownlevelExchangeServerVersion.Exchange2007); } catch (NoAvailableDownLevelBackEndException) { ExTraceGlobals.VerboseTracer.TraceError((long)this.GetHashCode(), "[DownLevelServerManager::GetDownLevelClientAccessServerWithPreferredServer]: No E12 CAS could be found for E12 destination. Looking for E14 CAS."); } } if (serviceType == null) { List <DownLevelServerStatusEntry> serverList2 = list; ServiceTopology topology2 = currentLegacyServiceTopology; Site targetSite2 = site; if (predicate2 == null) { predicate2 = ((ServiceType service) => service.ServerVersionNumber >= Server.E14MinVersion && service.ServerVersionNumber < Server.E15MinVersion); } serviceType = this.GetClientAccessServiceFromList <ServiceType>(serverList2, topology2, anchorMailbox, targetSite2, clientAccessType, predicate2, logger, DownLevelServerManager.DownlevelExchangeServerVersion.Exchange2010); } return(new BackEndServer(serviceType.ServerFullyQualifiedDomainName, serviceType.ServerVersionNumber)); }
private static HttpProxyBackEndHelper.TopologyWithSites GetLegacyServiceTopologyWithSites(string serverFqdn) { ServiceTopology currentLegacyServiceTopology = ServiceTopology.GetCurrentLegacyServiceTopology("f:\\15.00.1497\\sources\\dev\\data\\src\\ApplicationLogic\\Cafe\\HttpProxyBackEndHelper.cs", "GetLegacyServiceTopologyWithSites", 1028); return(HttpProxyBackEndHelper.GetServiceTopologyWithSites(serverFqdn, currentLegacyServiceTopology)); }