private void Release() {
     if (_version != null) {
         Marshal.ReleaseComObject(_version);
         _version = null;
     }
     if (_versionManager != null) {
         Marshal.ReleaseComObject(_versionManager);
         _versionManager = null;
     }
 }
Ejemplo n.º 2
0
 private void Release()
 {
     if (_version != null)
     {
         Marshal.ReleaseComObject(_version);
         _version = null;
     }
     if (_versionManager != null)
     {
         Marshal.ReleaseComObject(_versionManager);
         _versionManager = null;
     }
 }
        internal IISVersionHelper(string version) {
            // version is null if we're supposed to use the OS's IIS installation
            if (version == null)
                return;

            try {
                _versionManager = CreateVersionManager();
                _version = _versionManager.GetVersionObject(version, IIS_PRODUCT_EXPRESS);
                _version.ApplyManifestContext();
            }
            catch {
                Release();
                throw;
            }
        }
Ejemplo n.º 4
0
 internal IISVersionHelper(string version)
 {
     if (version != null)
     {
         try
         {
             this._versionManager = CreateVersionManager();
             this._version        = this._versionManager.GetVersionObject(version, 2);
             this._version.ApplyManifestContext();
         }
         catch
         {
             this.Release();
             throw;
         }
     }
 }
 internal IISVersionHelper(string version)
 {
     if (version != null)
     {
         try
         {
             this._versionManager = CreateVersionManager();
             this._version = this._versionManager.GetVersionObject(version, 2);
             this._version.ApplyManifestContext();
         }
         catch
         {
             this.Release();
             throw;
         }
     }
 }
Ejemplo n.º 6
0
        internal IISVersionHelper(string version)
        {
            // version is null if we're supposed to use the OS's IIS installation
            if (version == null)
            {
                return;
            }

            try {
                _versionManager = CreateVersionManager();
                _version        = _versionManager.GetVersionObject(version, IIS_PRODUCT_EXPRESS);
                _version.ApplyManifestContext();
            }
            catch {
                Release();
                throw;
            }
        }
Ejemplo n.º 7
0
        private static IEnumerable<Website> GetIisExpressSites(IIISVersion ob)
        {
            try
            {
                var userData = ob.GetPropertyValue("userInstanceHelper") as IIISUserData;

                var path = Path.Combine(userData.IISDirectory, "config", "applicationhost.config");
                var doc = XDocument.Load(path);
                return from e in doc.Root.Element("system.applicationHost").Element("sites").Elements("site")
                       select new Website
                       {
                           Identity = (int)e.Attribute("id"),
                           Name = (string)e.Attribute("name"),
                           PhysicalPath = (string)e.Element("application").Element("virtualDirectory").Attribute("physicalPath"),
                           Url = GetIisExpressUrl(e)
                       };
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }

            return new Website[0];
        }