private ConfigurationCache.CacheEntry RequestEndpointInfo(Uri endpoint, int timeout)
        {
            IEndpointInformationRetriever endpointInformationRetriever = this.endpointRetrieverFactory.Create(endpoint, timeout);

            ConfigurationCache.CacheEntry cacheEntry;
            try
            {
                EndpointInformation endpointInformation = endpointInformationRetriever.FetchEndpointInformation();
                cacheEntry = new ConfigurationCache.CacheEntry(this.dateTimeFactory.GetUtcNow(), endpointInformation);
            }
            catch (EndpointConfigurationException ex)
            {
                ExTraceGlobals.ConfigurationCacheTracer.TraceError <string>((long)this.GetHashCode(), "Unable to fetch endpoint info. {0}", ex.Message);
                cacheEntry = new ConfigurationCache.CacheEntry(this.dateTimeFactory.GetUtcNow(), ex);
            }
            if (this.cache.ContainsKey(endpoint.AbsoluteUri))
            {
                this.cache[endpoint.AbsoluteUri] = cacheEntry;
            }
            else
            {
                this.cache.Add(endpoint.AbsoluteUri, cacheEntry);
            }
            return(cacheEntry);
        }
示例#2
0
 public UrlResolver(EndpointInformation endpointInformation)
 {
     if (endpointInformation == null)
     {
         throw new ArgumentNullException("endpointInformation");
     }
     this.endpointInformation = endpointInformation;
 }
 public CacheEntry(ExDateTime utcTimeStamp, EndpointInformation endpointInformation)
 {
     this.UtcTimeStamp        = utcTimeStamp;
     this.EndpointInformation = endpointInformation;
 }