Helicon Zoo: Ignore web configuration errors if Zoo is not installed
This commit is contained in:
parent
9204eba68a
commit
bf9f1c815f
1 changed files with 36 additions and 40 deletions
|
@ -675,52 +675,48 @@ namespace WebsitePanel.Providers.Web.Iis.WebObjects
|
|||
//
|
||||
foreach (var item in iisObject.Applications)
|
||||
{
|
||||
|
||||
|
||||
Configuration cfg = item.GetWebConfiguration();
|
||||
string location = siteId + ConfigurationUtility.GetQualifiedVirtualPath(item.Path);
|
||||
ConfigurationSection section;
|
||||
try
|
||||
{
|
||||
section = cfg.GetSection("system.webServer/heliconZoo", location);
|
||||
}
|
||||
catch(Exception)
|
||||
{
|
||||
// looks like Helicon Zoo is not installed, return empty array
|
||||
return vdirs.ToArray();
|
||||
}
|
||||
|
||||
Configuration cfg = item.GetWebConfiguration();
|
||||
string location = siteId + ConfigurationUtility.GetQualifiedVirtualPath(item.Path);
|
||||
ConfigurationSection section = cfg.GetSection("system.webServer/heliconZoo", location);
|
||||
|
||||
if (section.GetCollection().Count > 0)
|
||||
{
|
||||
WebVirtualDirectory vdir = new WebVirtualDirectory
|
||||
{
|
||||
Name = ConfigurationUtility.GetNonQualifiedVirtualPath(item.Path),
|
||||
ContentPath = item.VirtualDirectories[0].PhysicalPath
|
||||
};
|
||||
|
||||
ConfigurationElement zooAppElement = section.GetCollection()[0];
|
||||
ConfigurationElementCollection envColl = zooAppElement.GetChildElement("environmentVariables").GetCollection();
|
||||
|
||||
foreach (ConfigurationElement env in envColl)
|
||||
if (section.GetCollection().Count > 0)
|
||||
{
|
||||
WebVirtualDirectory vdir = new WebVirtualDirectory
|
||||
{
|
||||
if ((string) env.GetAttributeValue("name") == "CONSOLE_URL")
|
||||
Name = ConfigurationUtility.GetNonQualifiedVirtualPath(item.Path),
|
||||
ContentPath = item.VirtualDirectories[0].PhysicalPath
|
||||
};
|
||||
|
||||
ConfigurationElement zooAppElement = section.GetCollection()[0];
|
||||
ConfigurationElementCollection envColl = zooAppElement.GetChildElement("environmentVariables").GetCollection();
|
||||
|
||||
foreach (ConfigurationElement env in envColl)
|
||||
{
|
||||
if ((string) env.GetAttributeValue("name") == "CONSOLE_URL")
|
||||
{
|
||||
vdir.ConsoleUrl = ConfigurationUtility.GetQualifiedVirtualPath(item.Path);
|
||||
if (!vdir.ConsoleUrl.EndsWith("/"))
|
||||
{
|
||||
vdir.ConsoleUrl = ConfigurationUtility.GetQualifiedVirtualPath(item.Path);
|
||||
if (!vdir.ConsoleUrl.EndsWith("/"))
|
||||
{
|
||||
vdir.ConsoleUrl += "/";
|
||||
}
|
||||
vdir.ConsoleUrl += (string)env.GetAttributeValue("value");
|
||||
vdir.ConsoleUrl += "/";
|
||||
}
|
||||
vdir.ConsoleUrl += (string)env.GetAttributeValue("value");
|
||||
}
|
||||
|
||||
vdirs.Add(vdir);
|
||||
|
||||
}
|
||||
|
||||
vdirs.Add(vdir);
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//there is no zoo
|
||||
throw;
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
return vdirs.ToArray();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue