Ejemplo n.º 1
0
		public void Defaults ()
		{
			HostingEnvironmentSection s = new HostingEnvironmentSection ();

			Assert.AreEqual (TimeSpan.MaxValue, s.IdleTimeout, "A1");
			Assert.IsTrue (s.ShadowCopyBinAssemblies, "A2");
			Assert.AreEqual (TimeSpan.FromSeconds (30), s.ShutdownTimeout, "A3");
		}
Ejemplo n.º 2
0
 //
 // Called by HttpRuntime.HostingInit to initialize UrlMetadataSlidingExpiration
 //
 static internal void InitializeUrlMetadataSlidingExpiration(HostingEnvironmentSection section) {
     TimeSpan slidingExp = section.UrlMetadataSlidingExpiration;
     if (slidingExp == TimeSpan.Zero) {
         // a value of TimeSpan.Zero means don't cache
         // this "feature" was added for Bing, because they
         // have scenarios where the same URL is never seen twice
         s_doNotCacheUrlMetadata = true;
     }
     else if (slidingExp == TimeSpan.MaxValue) {
         // a value of TimeSpan.MaxValue means use Cache.NoSlidingExpiration,
         // which is how CachedPathData used to be cached, so this effectively
         // reverts to v2.0 behavior for caching CachedPathData
         s_urlMetadataSlidingExpiration = Cache.NoSlidingExpiration;
         s_doNotCacheUrlMetadata = false;
     }
     else {
         // anything in between means cache with that sliding expiration
         s_urlMetadataSlidingExpiration = slidingExp;
         s_doNotCacheUrlMetadata = false;
     }
 }
Ejemplo n.º 3
0
		public void ShutdownTimeout_validationFailure ()
		{
			HostingEnvironmentSection s = new HostingEnvironmentSection ();
			s.ShutdownTimeout = TimeSpan.FromSeconds (-1);
		}
 internal static void InitializeUrlMetadataSlidingExpiration(HostingEnvironmentSection section)
 {
     TimeSpan urlMetadataSlidingExpiration = section.UrlMetadataSlidingExpiration;
     if (urlMetadataSlidingExpiration == TimeSpan.Zero)
     {
         s_doNotCacheUrlMetadata = true;
     }
     else if (urlMetadataSlidingExpiration == TimeSpan.MaxValue)
     {
         s_urlMetadataSlidingExpiration = Cache.NoSlidingExpiration;
         s_doNotCacheUrlMetadata = false;
     }
     else
     {
         s_urlMetadataSlidingExpiration = urlMetadataSlidingExpiration;
         s_doNotCacheUrlMetadata = false;
     }
 }
Ejemplo n.º 5
0
 private void InitFusion(HostingEnvironmentSection hostingEnvironmentSection)
 {
   AppDomain domain = Thread.GetDomain();
   string str = this._appDomainAppPath;
   if (str.IndexOf(HttpRuntime.DoubleDirectorySeparatorString, 1, StringComparison.Ordinal) >= 1)
     str = (string) (object) str[0] + (object) str.Substring(1).Replace(HttpRuntime.DoubleDirectorySeparatorString, HttpRuntime.DirectorySeparatorString);
   domain.AppendPrivatePath(str + "bin");
   if (hostingEnvironmentSection != null && !hostingEnvironmentSection.ShadowCopyBinAssemblies)
     domain.ClearShadowCopyPath();
   else
     domain.SetShadowCopyPath(str + "bin");
   string fullName = Directory.GetParent(this._codegenDir).FullName;
   domain.SetCachePath(fullName);
   this._fusionInited = true;
 }
Ejemplo n.º 6
0
 private void GetInitConfigSections(out CacheSection cacheSection, out TrustSection trustSection, out SecurityPolicySection securityPolicySection, out CompilationSection compilationSection, out HostingEnvironmentSection hostingEnvironmentSection, out Exception initException)
 {
   cacheSection = (CacheSection) null;
   trustSection = (TrustSection) null;
   securityPolicySection = (SecurityPolicySection) null;
   compilationSection = (CompilationSection) null;
   hostingEnvironmentSection = (HostingEnvironmentSection) null;
   initException = (Exception) null;
   RuntimeConfig appLkgConfig = RuntimeConfig.GetAppLKGConfig();
   RuntimeConfig runtimeConfig = (RuntimeConfig) null;
   try
   {
     runtimeConfig = RuntimeConfig.GetAppConfig();
   }
   catch (Exception ex)
   {
     initException = ex;
   }
   if (runtimeConfig != null)
   {
     try
     {
       cacheSection = runtimeConfig.Cache;
     }
     catch (Exception ex)
     {
       if (initException == null)
         initException = ex;
     }
   }
   if (cacheSection == null)
     cacheSection = appLkgConfig.Cache;
   if (runtimeConfig != null)
   {
     try
     {
       trustSection = runtimeConfig.Trust;
     }
     catch (Exception ex)
     {
       if (initException == null)
         initException = ex;
     }
   }
   if (trustSection == null)
     trustSection = appLkgConfig.Trust;
   if (runtimeConfig != null)
   {
     try
     {
       securityPolicySection = runtimeConfig.SecurityPolicy;
     }
     catch (Exception ex)
     {
       if (initException == null)
         initException = ex;
     }
   }
   if (securityPolicySection == null)
     securityPolicySection = appLkgConfig.SecurityPolicy;
   if (runtimeConfig != null)
   {
     try
     {
       compilationSection = runtimeConfig.Compilation;
     }
     catch (Exception ex)
     {
       if (initException == null)
         initException = ex;
     }
   }
   if (compilationSection == null)
     compilationSection = appLkgConfig.Compilation;
   if (runtimeConfig != null)
   {
     try
     {
       hostingEnvironmentSection = runtimeConfig.HostingEnvironment;
     }
     catch (Exception ex)
     {
       if (initException == null)
         initException = ex;
     }
   }
   if (hostingEnvironmentSection != null)
     return;
   hostingEnvironmentSection = appLkgConfig.HostingEnvironment;
 }