Example #1
0
        public IEnumerable <IIssue> GetIssues()
        {
            List <IIssue> issues = new List <IIssue>();

            if (cleaner != null)
            {
                issues.AddRange(cleaner.GetIssues());
            }

            if (!c.get("diskcache.hashModifiedDate", true))
            {
                issues.Add(new Issue("DiskCache", "V4.0 no longer supports hashModifiedDate=false. Please remove this attribute.", IssueSeverity.ConfigurationError));
            }

            if (!HasFileIOPermission())
            {
                issues.Add(new Issue("DiskCache", "Failed to start: Write access to the cache directory is prohibited by your .NET trust level configuration.",
                                     "Please configure your .NET trust level to permit writing to the cache directory. Most medium trust configurations allow this, but yours does not.", IssueSeverity.ConfigurationError));
            }

            if (!HasNTFSPermission())
            {
                issues.Add(new Issue("DiskCache", "Not working: Your NTFS Security permissions are preventing the application from writing to the disk cache",
                                     "Please give user " + GetExecutingUser() + " read and write access to directory \"" + PhysicalCacheDir + "\" to correct the problem. You can access NTFS security settings by right-clicking the aforementioned folder and choosing Properties, then Security.", IssueSeverity.ConfigurationError));
            }

            if (!Started && !Enabled)
            {
                issues.Add(new Issue("DiskCache", "DiskCache is disabled in Web.config. Set enabled=true on the <diskcache /> element to fix.", null, IssueSeverity.ConfigurationError));
            }

            //Warn user about setting hashModifiedDate=false in a web garden.
            if (this.AsyncBufferSize < 1024 * 1024 * 2)
            {
                issues.Add(new Issue("DiskCache", "The asyncBufferSize should not be set below 2 megabytes (2097152). Found in the <diskcache /> element in Web.config.",
                                     "A buffer that is too small will cause requests to be processed synchronously. Remember to set the value to at least 4x the maximum size of an output image.", IssueSeverity.ConfigurationError));
            }


            if (CacheDriveOnNetwork())
            {
                issues.Add(new Issue("DiskCache", "It appears that the cache directory is located on a network drive.",
                                     "Both IIS and ASP.NET have trouble hosting websites with large numbers of folders over a network drive, such as a SAN. The cache will create " +
                                     Subfolders.ToString() + " subfolders. If the total number of network-hosted folders exceeds 100, you should contact [email protected] and consult the documentation for details on configuring IIS and ASP.NET for this situation.", IssueSeverity.Warning));
            }

            return(issues);
        }
Example #2
0
        public IEnumerable <IIssue> GetIssues()
        {
            List <IIssue> issues = new List <IIssue>();

            if (cleaner != null)
            {
                issues.AddRange(cleaner.GetIssues());
            }

            if (!HasFileIOPermission())
            {
                issues.Add(new Issue("DiskCache", "Failed to start: Write access to the cache directory is prohibited by your .NET trust level configuration.",
                                     "Please configure your .NET trust level to permit writing to the cache directory. Most medium trust configurations allow this, but yours does not.", IssueSeverity.ConfigurationError));
            }

            if (!HasNTFSPermission())
            {
                issues.Add(new Issue("DiskCache", "Not working: Your NTFS Security permissions are preventing the application from writing to the disk cache",
                                     "Please give user " + GetExecutingUser() + " read and write access to directory \"" + PhysicalCacheDir + "\" to correct the problem. You can access NTFS security settings by right-clicking the aformentioned folder and choosing Properties, then Security.", IssueSeverity.ConfigurationError));
            }

            if (!Started && !Enabled)
            {
                issues.Add(new Issue("DiskCache", "DiskCache is disabled in Web.config. Set enabled=true on the <diskcache /> element to fix.", null, IssueSeverity.ConfigurationError));
            }

            //Warn user about setting hashModifiedDate=false in a web garden.
            if (this.cleaner != null && cleaner.ExteralProcessCleaning && !this.HashModifiedDate)
            {
                issues.Add(new Issue("DiskCache", "You should set hashModifiedDate=\"true\" on the <diskcache /> element in Web.config.",
                                     "Setting false for this value in a Web Garden scenario can cause failed requests. (DiskCache detects one or more other process on this machine working on the same cache directory).", IssueSeverity.Critical));
            }
            if (this.AsyncBufferSize < 1024 * 1024 * 2)
            {
                issues.Add(new Issue("DiskCache", "The asyncBufferSize should not be set below 2 megabytes (2097152). Found in the <diskcache /> element in Web.config.",
                                     "A buffer that is too small will cause requests to be processed synchronously. Remember to set the value to at least 4x the maximum size of an output image.", IssueSeverity.ConfigurationError));
            }

            string physicalCache = PhysicalCacheDir;

            if (!string.IsNullOrEmpty(physicalCache))
            {
                bool isNetwork = false;
                if (physicalCache.StartsWith("\\\\"))
                {
                    isNetwork = true;
                }
                else
                {
                    try {
                        DriveInfo dri = new DriveInfo(Path.GetPathRoot(physicalCache));
                        if (dri.DriveType == DriveType.Network)
                        {
                            isNetwork = true;
                        }
                    } catch { }
                }
                if (isNetwork)
                {
                    issues.Add(new Issue("DiskCache", "It appears that the cache directory is located on a network drive.",
                                         "Both IIS and ASP.NET have trouble hosting websites with large numbers of folders over a network drive, such as a SAN. The cache will create " +
                                         Subfolders.ToString() + " subfolders. If the total number of network-hosted folders exceeds 100, you should contact [email protected] and consult the documentation for details on configuring IIS and ASP.NET for this situation.", IssueSeverity.Warning));
                }
            }

            return(issues);
        }