Set current directory by default (#4798)
This commit is contained in:
parent
163350e968
commit
72830ea943
|
|
@ -55,7 +55,7 @@ InProcessOptions::InProcessOptions(const ConfigurationSource &configurationSourc
|
|||
m_environmentVariables = aspNetCoreSection->GetKeyValuePairs(CS_ASPNETCORE_ENVIRONMENT_VARIABLES);
|
||||
|
||||
const auto handlerSettings = aspNetCoreSection->GetKeyValuePairs(CS_ASPNETCORE_HANDLER_SETTINGS);
|
||||
m_fSetCurrentDirectory = equals_ignore_case(find_element(handlerSettings, CS_ASPNETCORE_HANDLER_SET_CURRENT_DIRECTORY).value_or(L"false"), L"true");
|
||||
m_fSetCurrentDirectory = equals_ignore_case(find_element(handlerSettings, CS_ASPNETCORE_HANDLER_SET_CURRENT_DIRECTORY).value_or(L"true"), L"true");
|
||||
|
||||
m_dwStartupTimeLimitInMS = aspNetCoreSection->GetRequiredLong(CS_ASPNETCORE_PROCESS_STARTUP_TIME_LIMIT) * 1000;
|
||||
m_dwShutdownTimeLimitInMS = aspNetCoreSection->GetRequiredLong(CS_ASPNETCORE_PROCESS_SHUTDOWN_TIME_LIMIT) * 1000;
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
|
||||
private static void VerifyNoExtraTrailingBytes(string responseString)
|
||||
{
|
||||
if (!DeployerSelector.IsBackwardsCompatiblityTest)
|
||||
if (DeployerSelector.HasNewShim)
|
||||
{
|
||||
Assert.EndsWith("</html>\r\n", responseString);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
{
|
||||
Assert.Equal(_fixture.DeploymentResult.ContentRoot, await _fixture.Client.GetStringAsync("/ContentRootPath"));
|
||||
Assert.Equal(_fixture.DeploymentResult.ContentRoot + "\\wwwroot", await _fixture.Client.GetStringAsync("/WebRootPath"));
|
||||
Assert.Equal(Path.GetDirectoryName(_fixture.DeploymentResult.HostProcess.MainModule.FileName), await _fixture.Client.GetStringAsync("/CurrentDirectory"));
|
||||
Assert.Equal(_fixture.DeploymentResult.ContentRoot, await _fixture.DeploymentResult.HttpClient.GetStringAsync("/CurrentDirectory"));
|
||||
Assert.Equal(_fixture.DeploymentResult.ContentRoot + "\\", await _fixture.Client.GetStringAsync("/BaseDirectory"));
|
||||
Assert.Equal(_fixture.DeploymentResult.ContentRoot + "\\", await _fixture.Client.GetStringAsync("/ASPNETCORE_IIS_PHYSICAL_PATH"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -454,16 +454,15 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
public async Task SetCurrentDirectoryHandlerSettingWorks()
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||
deploymentParameters.HandlerSettings["SetCurrentDirectory"] = "true";
|
||||
deploymentParameters.HandlerSettings["SetCurrentDirectory"] = "false";
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
Assert.Equal(deploymentResult.ContentRoot, await deploymentResult.HttpClient.GetStringAsync("/ContentRootPath"));
|
||||
Assert.Equal(deploymentResult.ContentRoot + "\\wwwroot", await deploymentResult.HttpClient.GetStringAsync("/WebRootPath"));
|
||||
Assert.Equal(deploymentResult.ContentRoot, await deploymentResult.HttpClient.GetStringAsync("/CurrentDirectory"));
|
||||
Assert.Equal(Path.GetDirectoryName(deploymentResult.HostProcess.MainModule.FileName), await deploymentResult.HttpClient.GetStringAsync("/CurrentDirectory"));
|
||||
Assert.Equal(deploymentResult.ContentRoot + "\\", await deploymentResult.HttpClient.GetStringAsync("/BaseDirectory"));
|
||||
Assert.Equal(deploymentResult.ContentRoot + "\\", await deploymentResult.HttpClient.GetStringAsync("/ASPNETCORE_IIS_PHYSICAL_PATH"));
|
||||
Assert.Equal(Path.GetDirectoryName(deploymentResult.HostProcess.MainModule.FileName), await deploymentResult.HttpClient.GetStringAsync("/DllDirectory"));
|
||||
}
|
||||
|
||||
private static void MoveApplication(
|
||||
|
|
|
|||
|
|
@ -71,10 +71,14 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
|
||||
Assert.Equal(deploymentResult.ContentRoot, await deploymentResult.HttpClient.GetStringAsync("/ContentRootPath"));
|
||||
Assert.Equal(deploymentResult.ContentRoot + "\\wwwroot", await deploymentResult.HttpClient.GetStringAsync("/WebRootPath"));
|
||||
Assert.Equal(deploymentResult.ContentRoot, await deploymentResult.HttpClient.GetStringAsync("/CurrentDirectory"));
|
||||
|
||||
var expectedDll = variant.AncmVersion == AncmVersion.AspNetCoreModule ? "aspnetcore.dll" : "aspnetcorev2.dll";
|
||||
Assert.Contains(deploymentResult.HostProcess.Modules.OfType<ProcessModule>(), m=> m.FileName.Contains(expectedDll));
|
||||
|
||||
if (DeployerSelector.HasNewHandler && variant.HostingModel == HostingModel.InProcess)
|
||||
{
|
||||
Assert.Equal(deploymentResult.ContentRoot, await deploymentResult.HttpClient.GetStringAsync("/CurrentDirectory"));
|
||||
Assert.Equal(Path.GetDirectoryName(deploymentResult.HostProcess.MainModule.FileName), await deploymentResult.HttpClient.GetStringAsync("/DllDirectory"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
|
||||
public sealed class RequiresNewHandlerAttribute : Attribute, ITestCondition
|
||||
{
|
||||
public bool IsMet => !DeployerSelector.IsForwardsCompatibilityTest;
|
||||
public bool IsMet => DeployerSelector.HasNewHandler;
|
||||
|
||||
public string SkipReason => "Test verifies new behavior in the aspnetcorev2_inprocess.dll that isn't supported in earlier versions.";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
|
||||
public sealed class RequiresNewShimAttribute : Attribute, ITestCondition
|
||||
{
|
||||
public bool IsMet => !DeployerSelector.IsBackwardsCompatiblityTest;
|
||||
public bool IsMet => DeployerSelector.HasNewShim;
|
||||
|
||||
public string SkipReason => "Test verifies new behavior in the aspnetcorev2.dll that isn't supported in earlier versions.";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
public static class DeployerSelector
|
||||
{
|
||||
public static ServerType ServerType => ServerType.IIS;
|
||||
public static bool IsBackwardsCompatiblityTest => true;
|
||||
public static bool IsForwardsCompatibilityTest => false;
|
||||
public static bool HasNewShim => false;
|
||||
public static bool HasNewHandler => true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
public static class DeployerSelector
|
||||
{
|
||||
public static ServerType ServerType => ServerType.IIS;
|
||||
public static bool IsBackwardsCompatiblityTest => false;
|
||||
public static bool IsForwardsCompatibilityTest => true;
|
||||
public static bool HasNewShim => true;
|
||||
public static bool HasNewHandler => false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
public static class DeployerSelector
|
||||
{
|
||||
public static ServerType ServerType => ServerType.IIS;
|
||||
public static bool IsBackwardsCompatiblityTest => false;
|
||||
public static bool IsForwardsCompatibilityTest => false;
|
||||
public static bool HasNewShim => true;
|
||||
public static bool HasNewHandler => true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
public static class DeployerSelector
|
||||
{
|
||||
public static ServerType ServerType => ServerType.IISExpress;
|
||||
public static bool IsBackwardsCompatiblityTest => false;
|
||||
public static bool IsForwardsCompatibilityTest => false;
|
||||
public static bool HasNewShim => true;
|
||||
public static bool HasNewHandler => true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue