diff --git a/src/IISIntegration/dependencies.overrides.props b/src/IISIntegration/dependencies.overrides.props
index 8fa5d9fc58..5fb926e6f8 100644
--- a/src/IISIntegration/dependencies.overrides.props
+++ b/src/IISIntegration/dependencies.overrides.props
@@ -2,11 +2,12 @@
$(MSBuildAllProjects);$(MSBuildThisFileFullPath)
-
- 2.2.0-rtm-35665
- 2.2.0-rtm-35665
- 2.2.0-rtm-35665
+
+ 2.2.0-preview3-35497
+ 2.2.0-preview3-35497
+ 2.2.0-preview3-35497
+
2.1.0
2.1.0
2.1.0
diff --git a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/AppHostConfig/IIS.config b/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/AppHostConfig/IIS.config
deleted file mode 100644
index bc24ef9639..0000000000
--- a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/AppHostConfig/IIS.config
+++ /dev/null
@@ -1,740 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/AppOfflineTests.cs b/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/AppOfflineTests.cs
deleted file mode 100644
index 7d8d661ef0..0000000000
--- a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/AppOfflineTests.cs
+++ /dev/null
@@ -1,287 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.IO;
-using System.Net;
-using System.Net.Http;
-using System.Net.Sockets;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
-using Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests;
-using Microsoft.AspNetCore.Server.IntegrationTesting;
-using Microsoft.AspNetCore.Testing.xunit;
-using Microsoft.Extensions.Logging;
-using Xunit;
-using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
-
-namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
-{
- [Collection(PublishedSitesCollection.Name)]
- public class AppOfflineTests : IISFunctionalTestBase
- {
- private static readonly TimeSpan RetryDelay = TimeSpan.FromMilliseconds(100);
-
- private readonly PublishedSitesFixture _fixture;
-
- public AppOfflineTests(PublishedSitesFixture fixture)
- {
- _fixture = fixture;
- }
-
- [ConditionalTheory]
- [InlineData(HostingModel.InProcess)]
- [InlineData(HostingModel.OutOfProcess)]
- public async Task AppOfflineDroppedWhileSiteIsDown_SiteReturns503(HostingModel hostingModel)
- {
- var deploymentResult = await DeployApp(hostingModel);
-
- AddAppOffline(deploymentResult.ContentRoot);
-
- await AssertAppOffline(deploymentResult);
- DeletePublishOutput(deploymentResult);
- }
-
- [ConditionalTheory]
- [InlineData(HostingModel.InProcess)]
- [InlineData(HostingModel.OutOfProcess)]
- public async Task LockedAppOfflineDroppedWhileSiteIsDown_SiteReturns503(HostingModel hostingModel)
- {
- var deploymentResult = await DeployApp(hostingModel);
-
- // Add app_offline without shared access
- using (var stream = File.Open(Path.Combine(deploymentResult.ContentRoot, "app_offline.htm"), FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None))
- using (var writer = new StreamWriter(stream))
- {
- await writer.WriteLineAsync("App if offline but you wouldn't see this message");
- await writer.FlushAsync();
- await AssertAppOffline(deploymentResult, "");
- }
-
- DeletePublishOutput(deploymentResult);
- }
-
- [ConditionalTheory]
- [InlineData(HostingModel.InProcess, 500, "500.0")]
- [InlineData(HostingModel.OutOfProcess, 502, "502.5")]
- public async Task AppOfflineDroppedWhileSiteFailedToStartInShim_AppOfflineServed(HostingModel hostingModel, int statusCode, string content)
- {
- var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel: hostingModel, publish: true);
- deploymentParameters.WebConfigActionList.Add(WebConfigHelpers.AddOrModifyAspNetCoreSection("processPath", "nonexistent"));
-
- var deploymentResult = await DeployAsync(deploymentParameters);
-
- var result = await deploymentResult.HttpClient.GetAsync("/");
- Assert.Equal(statusCode, (int)result.StatusCode);
- Assert.Contains(content, await result.Content.ReadAsStringAsync());
-
- AddAppOffline(deploymentResult.ContentRoot);
-
- await AssertAppOffline(deploymentResult);
- DeletePublishOutput(deploymentResult);
- }
-
- [ConditionalFact(Skip = "https://github.com/aspnet/IISIntegration/issues/933")]
- public async Task AppOfflineDroppedWhileSiteFailedToStartInRequestHandler_SiteStops_InProcess()
- {
- var deploymentResult = await DeployApp(HostingModel.InProcess);
-
- // Set file content to empty so it fails at runtime
- File.WriteAllText(Path.Combine(deploymentResult.ContentRoot, "Microsoft.AspNetCore.Server.IIS.dll"), "");
-
- var result = await deploymentResult.HttpClient.GetAsync("/");
- Assert.Equal(500, (int)result.StatusCode);
- Assert.Contains("500.30", await result.Content.ReadAsStringAsync());
-
- AddAppOffline(deploymentResult.ContentRoot);
-
- await deploymentResult.AssertRecycledAsync(() => AssertAppOffline(deploymentResult));
- }
-
- [ConditionalFact]
- [RequiresIIS(IISCapability.ShutdownToken)]
- public async Task AppOfflineDroppedWhileSiteStarting_SiteShutsDown_InProcess()
- {
- // This test often hits a race between debug logging and stdout redirection closing the handle
- // we are fine having this race
- using (AppVerifier.Disable(DeployerSelector.ServerType, 0x300))
- {
- var deploymentResult = await DeployApp(HostingModel.InProcess);
-
- for (int i = 0; i < 10; i++)
- {
- // send first request and add app_offline while app is starting
- var runningTask = AssertAppOffline(deploymentResult);
-
- // This test tries to hit a race where we drop app_offline file while
- // in process application is starting, application start takes at least 400ms
- // so we back off for 100ms to allow request to reach request handler
- // Test itself is racy and can result in two scenarios
- // 1. ANCM detects app_offline before it starts the request - if AssertAppOffline succeeds we've hit it
- // 2. Intended scenario where app starts and then shuts down
- // In first case we remove app_offline and try again
- await Task.Delay(RetryDelay);
-
- AddAppOffline(deploymentResult.ContentRoot);
-
- try
- {
- await runningTask.DefaultTimeout();
-
- // if AssertAppOffline succeeded ANCM have picked up app_offline before starting the app
- // try again
- RemoveAppOffline(deploymentResult.ContentRoot);
- }
- catch
- {
- deploymentResult.AssertWorkerProcessStop();
- return;
- }
- }
-
- Assert.True(false);
-
- }
- }
-
- [ConditionalFact]
- public async Task AppOfflineDroppedWhileSiteRunning_SiteShutsDown_InProcess()
- {
- var deploymentResult = await AssertStarts(HostingModel.InProcess);
-
- AddAppOffline(deploymentResult.ContentRoot);
-
- await deploymentResult.AssertRecycledAsync(() => AssertAppOffline(deploymentResult));
- }
-
- [ConditionalFact]
- public async Task AppOfflineDroppedWhileSiteRunning_SiteShutsDown_OutOfProcess()
- {
- var deploymentResult = await AssertStarts(HostingModel.OutOfProcess);
-
- // Repeat dropping file and restarting multiple times
- for (int i = 0; i < 5; i++)
- {
- AddAppOffline(deploymentResult.ContentRoot);
- await AssertAppOffline(deploymentResult);
- RemoveAppOffline(deploymentResult.ContentRoot);
- await AssertRunning(deploymentResult);
- }
-
- AddAppOffline(deploymentResult.ContentRoot);
- await AssertAppOffline(deploymentResult);
- DeletePublishOutput(deploymentResult);
- }
-
- [ConditionalTheory]
- [InlineData(HostingModel.InProcess)]
- [InlineData(HostingModel.OutOfProcess)]
- public async Task AppOfflineDropped_CanRemoveAppOfflineAfterAddingAndSiteWorks(HostingModel hostingModel)
- {
- var deploymentResult = await DeployApp(hostingModel);
-
- AddAppOffline(deploymentResult.ContentRoot);
-
- await AssertAppOffline(deploymentResult);
-
- RemoveAppOffline(deploymentResult.ContentRoot);
-
- await AssertRunning(deploymentResult);
- }
-
- [ConditionalTheory]
- [InlineData(HostingModel.InProcess)]
- [InlineData(HostingModel.OutOfProcess)]
- public async Task AppOfflineAddedAndRemovedStress(HostingModel hostingModel)
- {
- var deploymentResult = await AssertStarts(hostingModel);
-
- var load = Helpers.StressLoad(deploymentResult.HttpClient, "/HelloWorld", response => {
- var statusCode = (int)response.StatusCode;
- Assert.True(statusCode == 200 || statusCode == 503, "Status code was " + statusCode);
- });
-
- for (int i = 0; i < 100; i++)
- {
- // AddAppOffline might fail if app_offline is being read by ANCM and deleted at the same time
- RetryHelper.RetryOperation(
- () => AddAppOffline(deploymentResult.ContentRoot),
- e => Logger.LogError($"Failed to create app_offline : {e.Message}"),
- retryCount: 3,
- retryDelayMilliseconds: RetryDelay.Milliseconds);
- RemoveAppOffline(deploymentResult.ContentRoot);
- }
-
- try
- {
- await load;
- }
- catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException)
- {
- // IOException in InProcess is fine, just means process stopped
- if (hostingModel != HostingModel.InProcess)
- {
- throw;
- }
- }
- }
-
- private async Task DeployApp(HostingModel hostingModel = HostingModel.InProcess)
- {
- var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel: hostingModel, publish: true);
-
- return await DeployAsync(deploymentParameters);
- }
-
- private void AddAppOffline(string appPath, string content = "The app is offline.")
- {
- File.WriteAllText(Path.Combine(appPath, "app_offline.htm"), content);
- }
-
- private void RemoveAppOffline(string appPath)
- {
- RetryHelper.RetryOperation(
- () => File.Delete(Path.Combine(appPath, "app_offline.htm")),
- e => Logger.LogError($"Failed to remove app_offline : {e.Message}"),
- retryCount: 3,
- retryDelayMilliseconds: RetryDelay.Milliseconds);
- }
-
- private async Task AssertAppOffline(IISDeploymentResult deploymentResult, string expectedResponse = "The app is offline.")
- {
- var response = await deploymentResult.HttpClient.RetryRequestAsync("HelloWorld", r => r.StatusCode == HttpStatusCode.ServiceUnavailable);
- Assert.Equal(expectedResponse, await response.Content.ReadAsStringAsync());
- }
-
- private async Task AssertStarts(HostingModel hostingModel)
- {
- var deploymentResult = await DeployApp(hostingModel);
-
- await AssertRunning(deploymentResult);
-
- return deploymentResult;
- }
-
- private static async Task AssertRunning(IISDeploymentResult deploymentResult)
- {
- var response = await deploymentResult.HttpClient.RetryRequestAsync("HelloWorld", r => r.IsSuccessStatusCode);
- var responseText = await response.Content.ReadAsStringAsync();
- Assert.Equal("Hello World", responseText);
- }
-
- private void DeletePublishOutput(IISDeploymentResult deploymentResult)
- {
- foreach (var file in Directory.GetFiles(deploymentResult.ContentRoot, "*", SearchOption.AllDirectories))
- {
- // Out of process module dll is allowed to be locked
- var name = Path.GetFileName(file);
- if (name == "aspnetcore.dll" || name == "aspnetcorev2.dll" || name == "aspnetcorev2_outofprocess.dll")
- {
- continue;
- }
- File.Delete(file);
- }
- }
-
- }
-}
diff --git a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/BasicAuthTests.cs b/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/BasicAuthTests.cs
deleted file mode 100644
index d8607db21e..0000000000
--- a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/BasicAuthTests.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Text;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
-using Microsoft.AspNetCore.Server.IntegrationTesting;
-using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
-using Microsoft.AspNetCore.Testing.xunit;
-using Xunit;
-
-namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
-{
- [Collection(PublishedSitesCollection.Name)]
- public class BasicAuthTests : IISFunctionalTestBase
- {
- private readonly PublishedSitesFixture _fixture;
-
- public BasicAuthTests(PublishedSitesFixture fixture)
- {
- _fixture = fixture;
- }
-
- public static TestMatrix TestVariants
- => TestMatrix.ForServers(DeployerSelector.ServerType)
- .WithTfms(Tfm.NetCoreApp22)
- .WithApplicationTypes(ApplicationType.Portable)
- .WithAllAncmVersions()
- .WithAllHostingModels();
-
- [ConditionalTheory]
- [RequiresEnvironmentVariable("ASPNETCORE_MODULE_TEST_USER")]
- [RequiresIIS(IISCapability.BasicAuthentication)]
- [MemberData(nameof(TestVariants))]
- public async Task BasicAuthTest(TestVariant variant)
- {
- var username = Environment.GetEnvironmentVariable("ASPNETCORE_MODULE_TEST_USER");
- var password = Environment.GetEnvironmentVariable("ASPNETCORE_MODULE_TEST_PASSWORD");
-
- var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true);
- deploymentParameters.SetAnonymousAuth(enabled: false);
- deploymentParameters.SetWindowsAuth(enabled: false);
- deploymentParameters.SetBasicAuth(enabled: true);
-
- // The default in hosting sets windows auth to true.
- var deploymentResult = await DeployAsync(deploymentParameters);
- var request = new HttpRequestMessage(HttpMethod.Get, "/Auth");
- var byteArray = new UTF8Encoding().GetBytes(username + ":" + password);
- request.Headers.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
-
- var response = await deploymentResult.HttpClient.SendAsync(request);
-
- var responseText = await response.Content.ReadAsStringAsync();
-
- if (variant.HostingModel == HostingModel.InProcess)
- {
- Assert.StartsWith("Windows", responseText);
- Assert.Contains(username, responseText);
- }
- else
- {
- // We expect out-of-proc not allowing basic auth
- Assert.Equal("Windows", responseText);
- }
- }
- }
-}
diff --git a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/ClientCertificateFixture.cs b/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/ClientCertificateFixture.cs
deleted file mode 100644
index 40b6f2265e..0000000000
--- a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/ClientCertificateFixture.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-using Xunit;
-
-namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
-{
- public class ClientCertificateFixture : IDisposable
- {
- private X509Certificate2 _certificate;
- private const string _certIssuerPrefix = "CN=IISIntegrationTest_Root";
-
- public X509Certificate2 GetOrCreateCertificate()
- {
- if (_certificate != null)
- {
- return _certificate;
- }
-
- using (var store = new X509Store(StoreName.Root, StoreLocation.LocalMachine))
- {
- store.Open(OpenFlags.ReadWrite);
- var parentKey = CreateKeyMaterial(2048);
-
- // Create a cert name with a random guid to avoid name conflicts
- var parentRequest = new CertificateRequest(
- _certIssuerPrefix + Guid.NewGuid().ToString(),
- parentKey, HashAlgorithmName.SHA256,
- RSASignaturePadding.Pkcs1);
-
- parentRequest.CertificateExtensions.Add(
- new X509BasicConstraintsExtension(
- certificateAuthority: true,
- hasPathLengthConstraint: false,
- pathLengthConstraint: 0,
- critical: true));
-
- parentRequest.CertificateExtensions.Add(
- new X509KeyUsageExtension(X509KeyUsageFlags.DigitalSignature | X509KeyUsageFlags.NonRepudiation, critical: true));
-
- parentRequest.CertificateExtensions.Add(
- new X509SubjectKeyIdentifierExtension(parentRequest.PublicKey, false));
-
- var notBefore = DateTimeOffset.Now.AddDays(-1);
- var notAfter = DateTimeOffset.Now.AddYears(5);
-
- var parentCert = parentRequest.CreateSelfSigned(notBefore, notAfter);
-
- // Need to export/import the certificate to associate the private key with the cert.
- var imported = parentCert;
-
- var export = parentCert.Export(X509ContentType.Pkcs12, "");
- imported = new X509Certificate2(export, "", X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable);
- Array.Clear(export, 0, export.Length);
-
- // Add the cert to the cert store
- _certificate = imported;
-
- store.Add(certificate: imported);
- store.Close();
- return imported;
- }
- }
-
- public void Dispose()
- {
- if (_certificate == null)
- {
- return;
- }
-
- using (var store = new X509Store(StoreName.Root, StoreLocation.LocalMachine))
- {
- store.Open(OpenFlags.ReadWrite);
- store.Remove(_certificate);
-
- // Remove any extra certs that were left by previous tests.
- for (var i = store.Certificates.Count - 1; i >= 0; i--)
- {
- var cert = store.Certificates[i];
- if (cert.Issuer.StartsWith(_certIssuerPrefix))
- {
- store.Remove(cert);
- }
- }
- store.Close();
- }
- }
-
- private RSA CreateKeyMaterial(int minimumKeySize)
- {
- var rsa = RSA.Create(minimumKeySize);
- if (rsa.KeySize < minimumKeySize)
- {
- throw new InvalidOperationException($"Failed to create a key with a size of {minimumKeySize} bits");
- }
-
- return rsa;
- }
- }
-}
diff --git a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/ClientCertificateTests.cs b/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/ClientCertificateTests.cs
deleted file mode 100644
index 43ccc83eff..0000000000
--- a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/ClientCertificateTests.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Net.Http;
-using System.Security.Cryptography.X509Certificates;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
-using Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests;
-using Microsoft.AspNetCore.Server.IntegrationTesting;
-using Microsoft.AspNetCore.Server.IntegrationTesting.Common;
-using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
-using Microsoft.AspNetCore.Testing.xunit;
-using Microsoft.Extensions.Logging;
-using Xunit;
-
-namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
-{
- [Collection(PublishedSitesCollection.Name)]
- [SkipIfNotAdmin]
- public class ClientCertificateTests : IISFunctionalTestBase
- {
- private readonly PublishedSitesFixture _fixture;
- private readonly ClientCertificateFixture _certFixture;
-
- public ClientCertificateTests(PublishedSitesFixture fixture, ClientCertificateFixture certFixture)
- {
- _fixture = fixture;
- _certFixture = certFixture;
- }
-
- public static TestMatrix TestVariants
- => TestMatrix.ForServers(DeployerSelector.ServerType)
- .WithTfms(Tfm.NetCoreApp22, Tfm.Net461)
- .WithAllApplicationTypes()
- .WithAllAncmVersions()
- .WithAllHostingModels();
-
- [ConditionalTheory]
- [MemberData(nameof(TestVariants))]
- public Task HttpsNoClientCert_NoClientCert(TestVariant variant)
- {
- return ClientCertTest(variant, sendClientCert: false);
- }
-
- [ConditionalTheory]
- [MemberData(nameof(TestVariants))]
- public Task HttpsClientCert_GetCertInformation(TestVariant variant)
- {
- return ClientCertTest(variant, sendClientCert: true);
- }
-
- private async Task ClientCertTest(TestVariant variant, bool sendClientCert)
- {
- var port = TestPortHelper.GetNextSSLPort();
- var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant);
- deploymentParameters.ApplicationBaseUriHint = $"https://localhost:{port}/";
- deploymentParameters.AddHttpsToServerConfig();
-
- var handler = new HttpClientHandler
- {
- ServerCertificateCustomValidationCallback = (a, b, c, d) => true,
- ClientCertificateOptions = ClientCertificateOption.Manual,
- };
-
- X509Certificate2 cert = null;
- if (sendClientCert)
- {
- cert = _certFixture.GetOrCreateCertificate();
- handler.ClientCertificates.Add(cert);
- }
-
- var deploymentResult = await DeployAsync(deploymentParameters);
-
- var client = deploymentResult.CreateClient(handler);
- var response = await client.GetAsync("GetClientCert");
-
- var responseText = await response.Content.ReadAsStringAsync();
-
- try
- {
- if (sendClientCert)
- {
- Assert.Equal($"Enabled;{cert.GetCertHashString()}", responseText);
- }
- else
- {
- Assert.Equal("Disabled", responseText);
- }
- }
- catch (Exception ex)
- {
- Logger.LogError($"Certificate is invalid. Issuer name: {cert.Issuer}");
- using (var store = new X509Store(StoreName.Root, StoreLocation.LocalMachine))
- {
- Logger.LogError($"List of current certificates in root store:");
- store.Open(OpenFlags.ReadWrite);
- foreach (var otherCert in store.Certificates)
- {
- Logger.LogError(otherCert.Issuer);
- }
- store.Close();
- }
- throw ex;
- }
- }
- }
-}
diff --git a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/ClientDisconnectStress.cs b/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/ClientDisconnectStress.cs
deleted file mode 100644
index 9deeae3f92..0000000000
--- a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/ClientDisconnectStress.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Net.Http;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Server.IntegrationTesting;
-using Microsoft.AspNetCore.Testing.xunit;
-using Xunit;
-
-namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
-{
- [Collection(PublishedSitesCollection.Name)]
- public class ClientDisconnectStressTests: FunctionalTestsBase
- {
- private readonly PublishedSitesFixture _fixture;
-
- public ClientDisconnectStressTests(PublishedSitesFixture fixture)
- {
- _fixture = fixture;
- }
-
- [ConditionalTheory]
- [InlineData(HostingModel.InProcess)]
- [InlineData(HostingModel.OutOfProcess)]
- public async Task ClientDisconnectStress(HostingModel hostingModel)
- {
- var site = await StartAsync(_fixture.GetBaseDeploymentParameters(hostingModel));
- var maxRequestSize = 1000;
- var blockSize = 40;
- var random = new Random();
- async Task RunRequests()
- {
- using (var connection = new TestConnection(site.HttpClient.BaseAddress.Port))
- {
- await connection.Send(
- "POST /ReadAndFlushEcho HTTP/1.1",
- $"Content-Length: {maxRequestSize}",
- "Host: localhost",
- "Connection: close",
- "",
- "");
-
- var disconnectAfter = random.Next(maxRequestSize);
- var data = new byte[blockSize];
- for (int i = 0; i < disconnectAfter / blockSize; i++)
- {
- await connection.Stream.WriteAsync(data);
- }
- }
- }
-
- List tasks = new List();
- for (int i = 0; i < 100; i++)
- {
- tasks.Add(Task.Run(RunRequests));
- }
-
- await Task.WhenAll(tasks);
-
- StopServer();
- }
- }
-}
diff --git a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/CommonStartupTests.cs b/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/CommonStartupTests.cs
deleted file mode 100644
index e2bcf2a8f9..0000000000
--- a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/CommonStartupTests.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Net;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
-using Microsoft.AspNetCore.Server.IntegrationTesting;
-using Microsoft.AspNetCore.Testing.xunit;
-using Xunit;
-
-namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
-{
- [Collection(PublishedSitesCollection.Name)]
- public class CommonStartupTests : IISFunctionalTestBase
- {
- private readonly PublishedSitesFixture _fixture;
-
- public CommonStartupTests(PublishedSitesFixture fixture)
- {
- _fixture = fixture;
- }
-
- public static TestMatrix TestVariants
- => TestMatrix.ForServers(DeployerSelector.ServerType)
- .WithTfms(Tfm.NetCoreApp22)
- .WithAllApplicationTypes()
- .WithAllAncmVersions()
- .WithAllHostingModels();
-
- [ConditionalTheory]
- [MemberData(nameof(TestVariants))]
- public async Task StartupStress(TestVariant variant)
- {
- var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true);
-
- var deploymentResult = await DeployAsync(deploymentParameters);
-
- await Helpers.StressLoad(deploymentResult.HttpClient, "/HelloWorld", response => {
- Assert.Equal(HttpStatusCode.OK, response.StatusCode);
- Assert.Equal("Hello World", response.Content.ReadAsStringAsync().GetAwaiter().GetResult());
- });
- }
- }
-}
diff --git a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/CompressionTests.cs b/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/CompressionTests.cs
deleted file mode 100644
index c2d0277c4c..0000000000
--- a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/CompressionTests.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Linq;
-using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Testing.xunit;
-using Xunit;
-
-namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
-{
- [Collection(IISCompressionSiteCollection.Name)]
- public abstract class CompressionTests : FixtureLoggedTest
- {
- private readonly IISTestSiteFixture _fixture;
-
- [Collection(IISTestSiteCollection.Name)]
- public class InProc: CompressionTests
- {
- public InProc(IISTestSiteFixture fixture) : base(fixture) { }
- }
-
- [Collection(OutOfProcessTestSiteCollection.Name)]
- public class OutOfProcess: CompressionTests
- {
- public OutOfProcess(OutOfProcessTestSiteFixture fixture) : base(fixture) { }
- }
-
- [Collection(OutOfProcessV1TestSiteCollection.Name)]
- public class OutOfProcessV1: CompressionTests
- {
- public OutOfProcessV1(OutOfProcessV1TestSiteFixture fixture) : base(fixture) { }
- }
-
- protected CompressionTests(IISTestSiteFixture fixture) : base(fixture)
- {
- _fixture = fixture;
- }
-
- [ConditionalFact]
- public async Task PassesThroughCompression()
- {
- var request = new HttpRequestMessage(HttpMethod.Get, "/CompressedData");
-
- request.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
-
- var response = await _fixture.Client.SendAsync(request);
- Assert.Equal("gzip", response.Content.Headers.ContentEncoding.Single());
- Assert.Equal(
- new byte[] {
- 0x1F, 0x8B, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x0B, 0x63, 0x60, 0xA0, 0x3D, 0x00, 0x00,
- 0xCA, 0xC6, 0x88, 0x99, 0x64, 0x00, 0x00, 0x00 },
- await response.Content.ReadAsByteArrayAsync());
- }
- }
-}
diff --git a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/ConfigurationChangeTests.cs b/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/ConfigurationChangeTests.cs
deleted file mode 100644
index 099cefb97a..0000000000
--- a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/ConfigurationChangeTests.cs
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.Http;
-using System.Net.Sockets;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
-using Microsoft.AspNetCore.Server.IntegrationTesting;
-using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
-using Microsoft.AspNetCore.Testing.xunit;
-using Microsoft.Extensions.Logging;
-using Xunit;
-
-namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
-{
- [Collection(PublishedSitesCollection.Name)]
- public class ConfigurationChangeTests : IISFunctionalTestBase
- {
- private static readonly TimeSpan RetryDelay = TimeSpan.FromMilliseconds(100);
- private readonly PublishedSitesFixture _fixture;
-
- public ConfigurationChangeTests(PublishedSitesFixture fixture)
- {
- _fixture = fixture;
- }
-
- [ConditionalFact]
- public async Task ConfigurationChangeStopsInProcess()
- {
- var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.InProcess, publish: true);
-
- var deploymentResult = await DeployAsync(deploymentParameters);
-
- await deploymentResult.AssertStarts();
-
- // Just "touching" web.config should be enough
- deploymentResult.ModifyWebConfig(element => {});
-
- await deploymentResult.AssertRecycledAsync();
- }
-
- [ConditionalTheory]
- [InlineData(AncmVersion.AspNetCoreModule)]
- [InlineData(AncmVersion.AspNetCoreModuleV2)]
- public async Task ConfigurationChangeForcesChildProcessRestart(AncmVersion version)
- {
- var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess, publish: true);
- deploymentParameters.AncmVersion = version;
-
- var deploymentResult = await DeployAsync(deploymentParameters);
-
- var processBefore = await deploymentResult.HttpClient.GetStringAsync("/ProcessId");
-
- // Just "touching" web.config should be enough
- deploymentResult.ModifyWebConfig(element => {});
-
- // Have to retry here to allow ANCM to receive notification and react to it
- // Verify that worker process gets restarted with new process id
- await deploymentResult.HttpClient.RetryRequestAsync("/ProcessId", async r => await r.Content.ReadAsStringAsync() != processBefore);
- }
-
- [ConditionalFact]
- public async Task OutOfProcessToInProcessHostingModelSwitchWorks()
- {
- var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess, publish: true);
-
- var deploymentResult = await DeployAsync(deploymentParameters);
-
- await deploymentResult.AssertStarts();
-
- deploymentResult.ModifyWebConfig(element => element
- .Descendants("system.webServer")
- .Single()
- .GetOrAdd("aspNetCore")
- .SetAttributeValue("hostingModel", "inprocess"));
-
- // Have to retry here to allow ANCM to receive notification and react to it
- // Verify that inprocess application was created and tried to start
- await deploymentResult.HttpClient.RetryRequestAsync("/HelloWorld", r => r.StatusCode == HttpStatusCode.InternalServerError);
-
- StopServer();
- EventLogHelpers.VerifyEventLogEvent(deploymentResult, "Could not find the assembly 'aspnetcorev2_inprocess.dll'", Logger);
- }
-
- [ConditionalTheory]
- [InlineData(HostingModel.InProcess)]
- [InlineData(HostingModel.OutOfProcess)]
- public async Task ConfigurationTouchedStress(HostingModel hostingModel)
- {
- var deploymentResult = await DeployAsync(_fixture.GetBaseDeploymentParameters(hostingModel, publish: true));
-
- await deploymentResult.AssertStarts();
- var load = Helpers.StressLoad(deploymentResult.HttpClient, "/HelloWorld", response => {
- var statusCode = (int)response.StatusCode;
- Assert.True(statusCode == 200 || statusCode == 503, "Status code was " + statusCode);
- });
-
- for (int i = 0; i < 100; i++)
- {
- // ModifyWebConfig might fail if web.config is being read by IIS
- RetryHelper.RetryOperation(
- () => deploymentResult.ModifyWebConfig(element => {}),
- e => Logger.LogError($"Failed to touch web.config : {e.Message}"),
- retryCount: 3,
- retryDelayMilliseconds: RetryDelay.Milliseconds);
- }
-
- try
- {
- await load;
- }
- catch (HttpRequestException ex) when (ex.InnerException is IOException | ex.InnerException is SocketException)
- {
- // IOException in InProcess is fine, just means process stopped
- if (hostingModel != HostingModel.InProcess)
- {
- throw;
- }
- }
- }
- }
-}
diff --git a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/Inprocess/ClientDisconnectTests.cs b/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/Inprocess/ClientDisconnectTests.cs
deleted file mode 100644
index 6e2d1bc752..0000000000
--- a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/Inprocess/ClientDisconnectTests.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Testing.xunit;
-using Microsoft.Extensions.Logging;
-using Xunit;
-
-namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
-{
- [Collection(IISTestSiteCollection.Name)]
- public class ClientDisconnectTests: FixtureLoggedTest
- {
- private readonly IISTestSiteFixture _fixture;
-
- public ClientDisconnectTests(IISTestSiteFixture fixture): base(fixture)
- {
- _fixture = fixture;
- }
-
- [ConditionalFact]
- public async Task ServerWorksAfterClientDisconnect()
- {
- using (var connection = _fixture.CreateTestConnection())
- {
- var message = "Hello";
- await connection.Send(
- "POST /ReadAndWriteSynchronously HTTP/1.1",
- $"Content-Length: {100000}",
- "Host: localhost",
- "Connection: close",
- "",
- "");
-
- await connection.Send(message);
-
- await connection.Receive(
- "HTTP/1.1 200 OK",
- "");
- }
-
- var response = await _fixture.Client.GetAsync("HelloWorld");
-
- var responseText = await response.Content.ReadAsStringAsync();
- Assert.Equal("Hello World", responseText);
- }
-
- [ConditionalFact]
- public async Task RequestAbortedTokenFires()
- {
- using (var connection = _fixture.CreateTestConnection())
- {
- await connection.Send(
- "GET /WaitForAbort HTTP/1.1",
- "Host: localhost",
- "Connection: close",
- "",
- "");
-
- await _fixture.Client.RetryRequestAsync("/WaitingRequestCount", async message => await message.Content.ReadAsStringAsync() == "1");
- }
-
- await _fixture.Client.RetryRequestAsync("/WaitingRequestCount", async message => await message.Content.ReadAsStringAsync() == "0");
- }
-
- [ConditionalFact]
- public async Task ClientDisconnectCallbackStress()
- {
- // Fixture initialization fails if inside of the Task.Run, so send an
- // initial request to initialize the fixture.
- var response = await _fixture.Client.GetAsync("HelloWorld");
- var numTotalRequests = 0;
- for (var j = 0; j < 20; j++)
- {
- // Windows has a max connection limit of 10 for the IIS server,
- // so setting limit fairly low.
- const int numRequests = 5;
- async Task RunRequests()
- {
- using (var connection = _fixture.CreateTestConnection())
- {
- await connection.Send(
- "GET /WaitForAbort HTTP/1.1",
- "Host: localhost",
- "Connection: close",
- "",
- "");
- await _fixture.Client.RetryRequestAsync("/WaitingRequestCount", async message => await message.Content.ReadAsStringAsync() != "0");
- Interlocked.Increment(ref numTotalRequests);
- }
- }
-
- List tasks = new List();
- for (int i = 0; i < numRequests; i++)
- {
- tasks.Add(Task.Run(RunRequests));
- }
-
- await Task.WhenAll(tasks);
-
- await _fixture.Client.RetryRequestAsync("/WaitingRequestCount", async message => await message.Content.ReadAsStringAsync() == "0");
- }
- }
- }
-}
diff --git a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/Inprocess/CompressionTests.cs b/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/Inprocess/CompressionTests.cs
deleted file mode 100644
index ce1c84e609..0000000000
--- a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/Inprocess/CompressionTests.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Net;
-using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Testing.xunit;
-using Xunit;
-
-namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
-{
- [Collection(IISCompressionSiteCollection.Name)]
- public class CompressionModuleTests : FixtureLoggedTest
- {
- private readonly IISCompressionSiteFixture _fixture;
-
- public CompressionModuleTests(IISCompressionSiteFixture fixture): base(fixture)
- {
- _fixture = fixture;
- }
-
- [ConditionalTheory]
- [RequiresIIS(IISCapability.DynamicCompression)]
- [InlineData(true)]
- [InlineData(false)]
- public async Task BufferingDisabled(bool compression)
- {
- using (var connection = _fixture.CreateTestConnection())
- {
- var requestLength = 0;
- var messages = new List();
- for (var i = 1; i < 100; i++)
- {
- var message = i + Environment.NewLine;
- requestLength += message.Length;
- messages.Add(message);
- }
-
- await connection.Send(
- "POST /ReadAndWriteEchoLinesNoBuffering HTTP/1.1",
- $"Content-Length: {requestLength}",
- "Accept-Encoding: " + (compression ? "gzip": "identity"),
- "Response-Content-Type: text/event-stream",
- "Host: localhost",
- "Connection: close",
- "",
- "");
-
- await connection.Receive(
- "HTTP/1.1 200 OK",
- "");
- await connection.ReceiveHeaders();
-
- foreach (var message in messages)
- {
- await connection.Send(message);
- await connection.ReceiveChunk(message);
- }
-
- await connection.Send("\r\n");
- await connection.ReceiveChunk("");
- await connection.WaitForConnectionClose();
- }
- }
-
- [ConditionalFact]
- [RequiresIIS(IISCapability.DynamicCompression)]
- public async Task DynamicResponsesAreCompressed()
- {
- var handler = new HttpClientHandler
- {
- AutomaticDecompression = DecompressionMethods.GZip
- };
- var client = new HttpClient(handler)
- {
- BaseAddress = _fixture.Client.BaseAddress,
- };
- client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
- client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("identity", 0));
- client.DefaultRequestHeaders.Add("Response-Content-Type", "text/event-stream");
- var messages = "Message1\r\nMessage2\r\n";
-
- // Send messages with terminator
- var response = await client.PostAsync("ReadAndWriteEchoLines", new StringContent(messages + "\r\n"));
- Assert.Equal(messages, await response.Content.ReadAsStringAsync());
- Assert.True(response.Content.Headers.TryGetValues("Content-Type", out var contentTypes));
- Assert.Single(contentTypes, "text/event-stream");
- // Not the cleanest check but I wasn't able to figure out other way to check
- // that response was compressed
- Assert.Contains("gzip", response.Content.GetType().FullName, StringComparison.OrdinalIgnoreCase);
- }
- }
-}
diff --git a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/Inprocess/EnvironmentVariableTests.cs b/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/Inprocess/EnvironmentVariableTests.cs
deleted file mode 100644
index ae8fde39ed..0000000000
--- a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/Inprocess/EnvironmentVariableTests.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Testing.xunit;
-using Xunit;
-
-namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
-{
- [Collection(IISTestSiteCollection.Name)]
- public class EnvironmentVariableTests: FixtureLoggedTest
- {
- private readonly IISTestSiteFixture _fixture;
-
- public EnvironmentVariableTests(IISTestSiteFixture fixture): base(fixture)
- {
- _fixture = fixture;
- }
-
- [ConditionalFact]
- public async Task GetUniqueEnvironmentVariable()
- {
- Assert.Equal("foobar", await _fixture.Client.GetStringAsync("/CheckEnvironmentVariable"));
- }
-
- [ConditionalFact]
- public async Task GetLongEnvironmentVariable()
- {
- Assert.Equal(
- "AReallyLongValueThatIsGreaterThan300CharactersToForceResizeInNative" +
- "AReallyLongValueThatIsGreaterThan300CharactersToForceResizeInNative" +
- "AReallyLongValueThatIsGreaterThan300CharactersToForceResizeInNative" +
- "AReallyLongValueThatIsGreaterThan300CharactersToForceResizeInNative" +
- "AReallyLongValueThatIsGreaterThan300CharactersToForceResizeInNative" +
- "AReallyLongValueThatIsGreaterThan300CharactersToForceResizeInNative",
- await _fixture.Client.GetStringAsync("/CheckEnvironmentLongValueVariable"));
- }
-
- [ConditionalFact]
- public async Task GetExistingEnvironmentVariable()
- {
- Assert.Contains(";foobarbaz", await _fixture.Client.GetStringAsync("/CheckAppendedEnvironmentVariable"));
- }
-
- [ConditionalFact]
- public async Task AuthHeaderEnvironmentVariableRemoved()
- {
- Assert.DoesNotContain("shouldberemoved", await _fixture.Client.GetStringAsync("/CheckRemoveAuthEnvironmentVariable"));
- }
- }
-}
diff --git a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/Inprocess/ErrorPagesTests.cs b/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/Inprocess/ErrorPagesTests.cs
deleted file mode 100644
index bf45949491..0000000000
--- a/src/IISIntegration/src/IISIntegration/test/Common.FunctionalTests/Inprocess/ErrorPagesTests.cs
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System.Net;
-using System.Net.Http;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
-using Microsoft.AspNetCore.Server.IntegrationTesting;
-using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
-using Microsoft.AspNetCore.Testing.xunit;
-using Xunit;
-
-namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
-{
- [Collection(PublishedSitesCollection.Name)]
- public class ErrorPagesTests : IISFunctionalTestBase
- {
- private readonly PublishedSitesFixture _fixture;
-
- public ErrorPagesTests(PublishedSitesFixture fixture)
- {
- _fixture = fixture;
- }
-
- [ConditionalFact]
- [RequiresIIS(IISCapability.PoolEnvironmentVariables)]
- public async Task IncludesAdditionalErrorPageTextInProcessHandlerLoadFailure_CorrectString()
- {
- var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
- var response = await DeployAppWithStartupFailure(deploymentParameters);
-
- Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
-
- StopServer();
-
- var responseString = await response.Content.ReadAsStringAsync();
- Assert.Contains("HTTP Error 500.0 - ANCM In-Process Handler Load Failure", responseString);
- VerifyNoExtraTrailingBytes(responseString);
-
- await AssertLink(response);
- }
-
- [ConditionalFact]
- [RequiresIIS(IISCapability.PoolEnvironmentVariables)]
- public async Task IncludesAdditionalErrorPageTextOutOfProcessStartupFailure_CorrectString()
- {
- var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess, publish: true);
- var response = await DeployAppWithStartupFailure(deploymentParameters);
-
- Assert.Equal(HttpStatusCode.BadGateway, response.StatusCode);
-
- StopServer();
-
- var responseString = await response.Content.ReadAsStringAsync();
- Assert.Contains("HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure", responseString);
- VerifyNoExtraTrailingBytes(responseString);
-
- await AssertLink(response);
- }
-
- [ConditionalFact]
- [RequiresIIS(IISCapability.PoolEnvironmentVariables)]
- public async Task IncludesAdditionalErrorPageTextOutOfProcessHandlerLoadFailure_CorrectString()
- {
- var deploymentParameters = _fixture.GetBaseDeploymentParameters(HostingModel.OutOfProcess, publish: true);
- deploymentParameters.HandlerSettings["handlerVersion"] = "88.93";
- deploymentParameters.EnvironmentVariables["ANCM_ADDITIONAL_ERROR_PAGE_LINK"] = "http://example";
-
- var deploymentResult = await DeployAsync(deploymentParameters);
- var response = await deploymentResult.HttpClient.GetAsync("HelloWorld");
-
- Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
-
- StopServer();
-
- var responseString = await response.Content.ReadAsStringAsync();
- Assert.Contains("HTTP Error 500.0 - ANCM Out-Of-Process Handler Load Failure", responseString);
- VerifyNoExtraTrailingBytes(responseString);
-
- await AssertLink(response);
- }
-
- [ConditionalFact]
- [RequiresIIS(IISCapability.PoolEnvironmentVariables)]
- [RequiresNewHandler]
- public async Task IncludesAdditionalErrorPageTextInProcessStartupFailure_CorrectString()
- {
- var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
- deploymentParameters.TransformArguments((a, _) => $"{a} EarlyReturn");
- deploymentParameters.EnvironmentVariables["ANCM_ADDITIONAL_ERROR_PAGE_LINK"] = "http://example";
-
- var deploymentResult = await DeployAsync(deploymentParameters);
- var response = await deploymentResult.HttpClient.GetAsync("HelloWorld");
-
- Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
-
- StopServer();
-
- var responseString = await response.Content.ReadAsStringAsync();
- Assert.Contains("HTTP Error 500.30 - ANCM In-Process Start Failure", responseString);
- VerifyNoExtraTrailingBytes(responseString);
-
- await AssertLink(response);
- }
-
- private static void VerifyNoExtraTrailingBytes(string responseString)
- {
- if (!DeployerSelector.IsBackwardsCompatiblityTest)
- {
- Assert.EndsWith("