diff --git a/build/dependencies.props b/build/dependencies.props index d5392bf..ce1352a 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,12 +4,16 @@ 2.2.0-preview1-17099 + 2.2.0-a-preview1-croot-17070 + 2.2.0-a-preview1-croot-17070 2.2.0-preview1-34755 2.2.0-preview1-34755 2.2.0-preview1-34755 2.2.0-preview1-34755 - 2.2.0-preview1-34755 + 2.2.0-a-preview1-croot-17070 + 2.2.0-a-preview1-croot-17070 0.6.0-preview1-34755 + 2.2.0-preview1-34755 2.2.0-preview1-34755 2.2.0-preview1-34755 2.2.0-preview1-34755 diff --git a/src/Microsoft.AspNetCore/Microsoft.AspNetCore.csproj b/src/Microsoft.AspNetCore/Microsoft.AspNetCore.csproj index e52a4f7..1e77df2 100644 --- a/src/Microsoft.AspNetCore/Microsoft.AspNetCore.csproj +++ b/src/Microsoft.AspNetCore/Microsoft.AspNetCore.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 @@ -13,6 +13,7 @@ + diff --git a/src/Microsoft.AspNetCore/WebHost.cs b/src/Microsoft.AspNetCore/WebHost.cs index 31ab946..985386a 100644 --- a/src/Microsoft.AspNetCore/WebHost.cs +++ b/src/Microsoft.AspNetCore/WebHost.cs @@ -210,6 +210,7 @@ namespace Microsoft.AspNetCore services.AddTransient(); }) + .UseIIS() .UseIISIntegration() .UseDefaultServiceProvider((context, options) => { diff --git a/test/Microsoft.AspNetCore.FunctionalTests/Microsoft.AspNetCore.FunctionalTests.csproj b/test/Microsoft.AspNetCore.FunctionalTests/Microsoft.AspNetCore.FunctionalTests.csproj index d4a5bbd..67422e1 100644 --- a/test/Microsoft.AspNetCore.FunctionalTests/Microsoft.AspNetCore.FunctionalTests.csproj +++ b/test/Microsoft.AspNetCore.FunctionalTests/Microsoft.AspNetCore.FunctionalTests.csproj @@ -20,6 +20,7 @@ + diff --git a/test/Microsoft.AspNetCore.FunctionalTests/WebHostFunctionalTests.cs b/test/Microsoft.AspNetCore.FunctionalTests/WebHostFunctionalTests.cs index 4942fef..a017c66 100644 --- a/test/Microsoft.AspNetCore.FunctionalTests/WebHostFunctionalTests.cs +++ b/test/Microsoft.AspNetCore.FunctionalTests/WebHostFunctionalTests.cs @@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting.Server.Features; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Server.IntegrationTesting; +using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Testing; using Xunit; @@ -165,6 +166,42 @@ namespace Microsoft.AspNetCore.Tests } } + [ConditionalFact] + [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] + public async Task RunsInIISExpressInProcess() + { + var applicationName = "CreateDefaultBuilderApp"; + var deploymentParameters = new DeploymentParameters(Path.Combine(_testSitesPath, applicationName), ServerType.IISExpress, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64) + { + TargetFramework = "netcoreapp2.2", + HostingModel = HostingModel.InProcess, + AncmVersion = AncmVersion.AspNetCoreModuleV2 + }; + + SetEnvironmentVariables(deploymentParameters, "Development"); + + using (var deployer = IISApplicationDeployerFactory.Create(deploymentParameters, LoggerFactory)) + { + var deploymentResult = await deployer.DeployAsync(); + var response = await RetryHelper.RetryRequest(() => deploymentResult.HttpClient.GetAsync(string.Empty), Logger, deploymentResult.HostShutdownToken, retryCount: 5); + + var responseText = await response.Content.ReadAsStringAsync(); + try + { + // Assert server is IISExpress + Assert.Equal("Microsoft-IIS/10.0", response.Headers.Server.ToString()); + // The application name will be sent in response when all asserts succeed in the test app. + Assert.Equal(applicationName, responseText); + } + catch (XunitException) + { + Logger.LogWarning(response.ToString()); + Logger.LogWarning(responseText); + throw; + } + } + } + private async Task ExecuteStartOrStartWithTest(Func> getResponse, string applicationName) { await ExecuteTestApp(applicationName, async (deploymentResult, logger) => @@ -197,11 +234,10 @@ namespace Microsoft.AspNetCore.Tests if (setTestEnvVars) { - deploymentParameters.EnvironmentVariables.Add(new KeyValuePair("aspnetcore_environment", environment)); - deploymentParameters.EnvironmentVariables.Add(new KeyValuePair("envKey", "envValue")); + SetEnvironmentVariables(deploymentParameters, environment); } - using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) + using (var deployer = IISApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) { var deploymentResult = await deployer.DeployAsync(); @@ -210,6 +246,12 @@ namespace Microsoft.AspNetCore.Tests } } + private static void SetEnvironmentVariables(DeploymentParameters deploymentParameters, string environment) + { + deploymentParameters.EnvironmentVariables.Add(new KeyValuePair("aspnetcore_environment", environment)); + deploymentParameters.EnvironmentVariables.Add(new KeyValuePair("envKey", "envValue")); + } + private static string GetTestSitesPath() { var applicationBasePath = AppContext.BaseDirectory; diff --git a/test/TestSites/CreateDefaultBuilderApp/CreateDefaultBuilderApp.csproj b/test/TestSites/CreateDefaultBuilderApp/CreateDefaultBuilderApp.csproj index 9fc88e0..74fe7e3 100644 --- a/test/TestSites/CreateDefaultBuilderApp/CreateDefaultBuilderApp.csproj +++ b/test/TestSites/CreateDefaultBuilderApp/CreateDefaultBuilderApp.csproj @@ -6,6 +6,12 @@ aspnetcore-CreateDefaultBuilder-20170424224131 + + + + + +