コード例 #1
0
        public static bool ChangeVdirPath(DirectoryEntry rootEntry, string espaceName, string path, string rootPath, UpdateOtherWebSiteIfAny updateOtherWebSiteIfAny)
        {
            bool changed = false;

            if (changeVdirOverride != null)
            {
                bool ok;
                changed = changeVdirOverride(espaceName, path, rootPath, out ok);
                if (ok)
                {
                    return(changed);
                }
            }

            // #994130 - Now uses the Microsoft.Web.Administration API to search IIS applications
            // we check all the websites to see if there's another entry point to the espace we are deploying
            // this loop in the old took a long time to execute in IIS8 and the time grew with the number of espaces deployed
            changed |= updateOtherWebSiteIfAny(espaceName, path, rootPath);

            // root dir entry is always written
            using (DirectoryEntry rootEntryEspaceDirEntry = OSDirectoryEntry.FindChildren(rootEntry, espaceName, "")) {
                if (rootEntryEspaceDirEntry.Properties["Path"][0].ToString() != path)
                {
                    rootEntryEspaceDirEntry.Properties["Path"][0] = path;
                    changed = true;
                    OSDirectoryEntry.CommitChanges(rootEntryEspaceDirEntry);
                }
            }

            return(changed);
        }
コード例 #2
0
 private static bool changeVdirPath(DirectoryEntry espaceDir, string espaceName, string path, string rootPath)
 {
     try {
         if (IsEspacePath(espaceName, espaceDir.Properties["Path"][0].ToString(), rootPath) && espaceDir.Properties["Path"][0].ToString() != path)
         {
             espaceDir.Properties["Path"][0] = path;
             OSDirectoryEntry.CommitChanges(espaceDir);
             return(true);
         }
     } catch (Exception e) {
         OSTrace.Error("Changing vdir", e);
     }
     return(false);
 }