bugfix: CheckLoadUserProfile() on IIS8

This commit is contained in:
Sergey 2012-09-27 15:31:34 +03:00
parent a7e191a748
commit c6d1fe9549
3 changed files with 41 additions and 14 deletions

View file

@ -4046,7 +4046,12 @@ namespace WebsitePanel.Providers.Web
{
using (var srvman = new ServerManager())
{
return srvman.ApplicationPools["WebsitePanel Server"].ProcessModel.LoadUserProfile;
string poolName = Environment.GetEnvironmentVariable("APP_POOL_ID", EnvironmentVariableTarget.Process);
ApplicationPool pool = srvman.ApplicationPools[poolName];
if (pool == null)
throw new Exception("ApplicationPool pool is null" + poolName);
return pool.ProcessModel.LoadUserProfile;
}
}
@ -4055,7 +4060,12 @@ namespace WebsitePanel.Providers.Web
{
using (var srvman = new ServerManager())
{
srvman.ApplicationPools["WebsitePanel Server"].ProcessModel.LoadUserProfile = true;
string poolName = Environment.GetEnvironmentVariable("APP_POOL_ID", EnvironmentVariableTarget.Process);
ApplicationPool pool = srvman.ApplicationPools[poolName];
if (pool == null)
throw new Exception("ApplicationPool pool is null" + poolName);
pool.ProcessModel.LoadUserProfile = true;
// save changes
srvman.CommitChanges();
}