Stop using IISExpress .config templates (#863)

This commit is contained in:
Pavel Krymets 2018-08-16 14:19:38 -07:00 committed by GitHub
parent 6bb902e607
commit 670598c05a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1046 deletions

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,7 @@ using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
@ -36,8 +37,6 @@ namespace E2ETests
ApplicationPath = Helpers.GetApplicationPath(),
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
EnvironmentName = "NtlmAuthentication", //Will pick the Start class named 'StartupNtlmAuthentication'
ServerConfigTemplateContent = Helpers.GetConfigContent(variant.Server, "NtlmAuthentation.config"),
SiteName = "MusicStoreNtlmAuthentication", //This is configured in the NtlmAuthentication.config
UserAdditionalCleanup = parameters =>
{
DbUtils.DropDatabase(musicStoreDbName, logger);
@ -50,6 +49,25 @@ namespace E2ETests
MusicStoreConfig.ConnectionStringKey,
DbUtils.CreateConnectionString(musicStoreDbName)));
if (variant.Server == ServerType.IISExpress)
{
var iisDeploymentParameters = new IISDeploymentParameters(deploymentParameters);
iisDeploymentParameters.ServerConfigActionList.Add(
(element, _) => {
var authentication = element
.RequiredElement("system.webServer")
.GetOrAdd("security")
.GetOrAdd("authentication");
authentication.GetOrAdd("anonymousAuthentication")
.SetAttributeValue("enabled", "false");
authentication.GetOrAdd("windowsAuthentication")
.SetAttributeValue("enabled", "true");
});
deploymentParameters = iisDeploymentParameters;
}
using (var deployer = IISApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
{
var deploymentResult = await deployer.DeployAsync();