コード例 #1
0
        public override string GetFqdn(string shortNodeName, bool throwException)
        {
            string result;

            try
            {
                ExTraceGlobals.FaultInjectionTracer.TraceTest(3081121085U);
                result = base.GetFqdn(shortNodeName, true);
            }
            catch (AmServerNameResolveFqdnException ex)
            {
                AmTrace.Error("FQDN resolution of the short name {0} failed. Error: {1}", new object[]
                {
                    shortNodeName,
                    ex.Message
                });
                ReplayEventLogConstants.Tuple_FqdnResolutionFailure.LogEvent(ExTraceGlobals.ActiveManagerTracer.GetHashCode().ToString(), new object[]
                {
                    shortNodeName,
                    ex.Message
                });
                result = AmServerNameCache.GetFqdnWithLocalDomainSuffix(shortNodeName);
            }
            return(result);
        }
コード例 #2
0
        // Token: 0x0600002B RID: 43 RVA: 0x000024F0 File Offset: 0x000006F0
        public static string ResolveFqdn(string shortNodeName, bool throwException)
        {
            string    fqdn = null;
            Exception ex   = SharedHelper.RunADOperationEx(delegate(object param0, EventArgs param1)
            {
                IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true);
                iadtoplogyConfigurationSession.UseConfigNC      = false;
                iadtoplogyConfigurationSession.UseGlobalCatalog = true;
                IADComputer iadcomputer = iadtoplogyConfigurationSession.FindComputerByHostName(shortNodeName);
                if (iadcomputer != null && !string.IsNullOrEmpty(iadcomputer.DnsHostName))
                {
                    fqdn = iadcomputer.DnsHostName;
                    return;
                }
                if (throwException)
                {
                    throw new AmGetFqdnFailedNotFoundException(shortNodeName);
                }
                AmTrace.Error("FQDN resolution of the short name {0} failed. Could not find valid DNS hostname from ADComputer query.", new object[]
                {
                    shortNodeName
                });
                fqdn = AmServerNameCache.GetFqdnWithLocalDomainSuffix(shortNodeName);
            });

            if (ex != null)
            {
                if (throwException)
                {
                    throw new AmGetFqdnFailedADErrorException(shortNodeName, ex.Message, ex);
                }
                AmTrace.Error("FQDN resolution of the short name {0} failed. Error: {1}", new object[]
                {
                    shortNodeName,
                    ex.Message
                });
                fqdn = AmServerNameCache.GetFqdnWithLocalDomainSuffix(shortNodeName);
            }
            return(fqdn);
        }