Only add environment variables if we are running on win8.1 or above. (#1007)
This commit is contained in:
parent
3efc1eede4
commit
e7d36a42e6
|
|
@ -198,19 +198,27 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
|
||||||
var pool = _serverManager.ApplicationPools.Add(AppPoolName);
|
var pool = _serverManager.ApplicationPools.Add(AppPoolName);
|
||||||
pool.ProcessModel.IdentityType = ProcessModelIdentityType.LocalSystem;
|
pool.ProcessModel.IdentityType = ProcessModelIdentityType.LocalSystem;
|
||||||
pool.ManagedRuntimeVersion = string.Empty;
|
pool.ManagedRuntimeVersion = string.Empty;
|
||||||
var envCollection = pool.GetCollection("environmentVariables");
|
|
||||||
|
|
||||||
AddEnvironmentVariables(contentRoot, envCollection);
|
AddEnvironmentVariables(contentRoot, pool);
|
||||||
|
|
||||||
_logger.LogInformation($"Configured AppPool {AppPoolName}");
|
_logger.LogInformation($"Configured AppPool {AppPoolName}");
|
||||||
return pool;
|
return pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddEnvironmentVariables(string contentRoot, ConfigurationElementCollection envCollection)
|
private void AddEnvironmentVariables(string contentRoot, ApplicationPool pool)
|
||||||
{
|
{
|
||||||
foreach (var tuple in _deploymentParameters.EnvironmentVariables)
|
try
|
||||||
{
|
{
|
||||||
AddEnvironmentVariableToAppPool(envCollection, tuple.Key, tuple.Value);
|
var envCollection = pool.GetCollection("environmentVariables");
|
||||||
|
|
||||||
|
foreach (var tuple in _deploymentParameters.EnvironmentVariables)
|
||||||
|
{
|
||||||
|
AddEnvironmentVariableToAppPool(envCollection, tuple.Key, tuple.Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (COMException comException)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"Could not add environment variables to worker process: {comException.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue