Helicon Ape: check pool mode on checking Helicon Ape is enabled

This commit is contained in:
Ruslan Keba 2013-04-01 13:41:23 +03:00
parent b1b36dfc27
commit a7b71955a0

View file

@ -1914,6 +1914,25 @@ namespace WebsitePanel.Providers.Web
private bool IsHeliconApeEnabled(ServerManager srvman, string siteId) private bool IsHeliconApeEnabled(ServerManager srvman, string siteId)
{ {
WebSite webSite = null;
webSite = webObjectsSvc.GetWebSiteFromIIS(srvman, siteId);
if (webSite == null)
throw new ApplicationException(
String.Format("Could not find a web site with the following identifier: {0}.", siteId));
// Fill ASP.NET settings
FillAspNetSettingsFromIISObject(srvman, webSite);
var aphl = new WebAppPoolHelper(ProviderSettings);
var currentPool = aphl.match_webapp_pool(webSite);
if (aphl.pipeline(currentPool.Mode) != SiteAppPoolMode.Integrated)
{
// Ape is not working in not Integrated pipeline mode
return false;
}
var appConfig = srvman.GetApplicationHostConfiguration(); var appConfig = srvman.GetApplicationHostConfiguration();
var modulesSection = appConfig.GetSection(Constants.ModulesSection, siteId); var modulesSection = appConfig.GetSection(Constants.ModulesSection, siteId);
var modulesCollection = modulesSection.GetCollection(); var modulesCollection = modulesSection.GetCollection();
@ -2298,6 +2317,9 @@ namespace WebsitePanel.Providers.Web
using (var srvman = webObjectsSvc.GetServerManager()) using (var srvman = webObjectsSvc.GetServerManager())
{ {
if (!IsHeliconApeEnabled(srvman, siteId))
{
Configuration appConfig = srvman.GetApplicationHostConfiguration(); Configuration appConfig = srvman.GetApplicationHostConfiguration();
// add Helicon.Ape module // add Helicon.Ape module
@ -2334,6 +2356,7 @@ namespace WebsitePanel.Providers.Web
srvman.CommitChanges(); srvman.CommitChanges();
} }
} }
}
/// <summary> /// <summary>
/// Disables Helicon Ape module & handler on the web site or server globally. /// Disables Helicon Ape module & handler on the web site or server globally.