Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public UrlResolver GetUrlResolver(HolidayConfigurationSnapshot configSnapshot)
 {
     ConfigurationCache.CacheEntry endpointCacheEntry = this.GetEndpointCacheEntry(configSnapshot);
     if (endpointCacheEntry.UrlResolver == null)
     {
         throw endpointCacheEntry.ErrorInformation;
     }
     return(endpointCacheEntry.UrlResolver);
 }