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; } }
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) { // 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; } }
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]; }