Add InProc ANCM support and react to deployer changes.

This commit is contained in:
Chris Ross (ASP.NET) 2018-05-31 14:20:46 -07:00
parent 664649bda9
commit 3ffb75f896
12 changed files with 29 additions and 1045 deletions

View File

@ -5,6 +5,7 @@
<PropertyGroup Label="Package Versions">
<MicrosoftAspNetCoreAllPackageVersion>2.2.0-preview1-34326</MicrosoftAspNetCoreAllPackageVersion>
<MicrosoftAspNetCoreAspNetCoreModulePackageVersion>2.2.0-preview1-34326</MicrosoftAspNetCoreAspNetCoreModulePackageVersion>
<MicrosoftAspNetCoreAspNetCoreModuleV2PackageVersion>2.2.0-preview1-34326</MicrosoftAspNetCoreAspNetCoreModuleV2PackageVersion>
<MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>2.2.0-preview1-34326</MicrosoftAspNetCoreAuthenticationCookiesPackageVersion>
<MicrosoftAspNetCoreAuthenticationCorePackageVersion>2.2.0-preview1-34326</MicrosoftAspNetCoreAuthenticationCorePackageVersion>
<MicrosoftAspNetCoreAuthenticationFacebookPackageVersion>2.2.0-preview1-34326</MicrosoftAspNetCoreAuthenticationFacebookPackageVersion>
@ -19,7 +20,8 @@
<MicrosoftAspNetCoreMvcRazorViewCompilationPackageVersion>2.2.0-preview1-34326</MicrosoftAspNetCoreMvcRazorViewCompilationPackageVersion>
<MicrosoftAspNetCorePackageVersion>2.2.0-preview1-34326</MicrosoftAspNetCorePackageVersion>
<MicrosoftAspNetCoreServerHttpSysPackageVersion>2.2.0-preview1-34326</MicrosoftAspNetCoreServerHttpSysPackageVersion>
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.6.0-preview1-34326</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
<MicrosoftAspNetCoreServerIISPackageVersion>2.2.0-preview1-34326</MicrosoftAspNetCoreServerIISPackageVersion>
<MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>0.6.0-a-preview1-tratcher-exp-17051</MicrosoftAspNetCoreServerIntegrationTestingPackageVersion>
<MicrosoftAspNetCoreSessionPackageVersion>2.2.0-preview1-34326</MicrosoftAspNetCoreSessionPackageVersion>
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.2.0-preview1-34326</MicrosoftAspNetCoreStaticFilesPackageVersion>
<MicrosoftAspNetCoreWebUtilitiesPackageVersion>2.2.0-preview1-34326</MicrosoftAspNetCoreWebUtilitiesPackageVersion>

View File

@ -3,16 +3,24 @@ using System.IO;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
namespace MusicStore.Mocks.OpenIdConnect
{
internal class OpenIdConnectBackChannelHttpHandler : HttpMessageHandler
{
private IHostingEnvironment _env;
public OpenIdConnectBackChannelHttpHandler(IHostingEnvironment env)
{
_env = env;
}
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
var response = new HttpResponseMessage();
var basePath = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "ForTesting", "Mocks", "OpenIdConnect"));
var basePath = Path.GetFullPath(Path.Combine(_env.ContentRootPath, "ForTesting", "Mocks", "OpenIdConnect"));
if (request.RequestUri.AbsoluteUri == "https://login.windows.net/[tenantName].onmicrosoft.com/.well-known/openid-configuration")
{

View File

@ -36,9 +36,11 @@ namespace MusicStore
Configuration = builder.Build();
_platform = new Platform();
Env = env;
}
public IConfiguration Configuration { get; private set; }
public IHostingEnvironment Env { get; }
public void ConfigureServices(IServiceCollection services)
{
@ -66,7 +68,7 @@ namespace MusicStore
{
options.Authority = "https://login.windows.net/[tenantName].onmicrosoft.com";
options.ClientId = "c99497aa-3ee2-4707-b8a8-c33f51323fef";
options.BackchannelHttpHandler = new OpenIdConnectBackChannelHttpHandler();
options.BackchannelHttpHandler = new OpenIdConnectBackChannelHttpHandler(Env);
options.StringDataFormat = new CustomStringDataFormat();
options.StateDataFormat = new CustomStateDataFormat();
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;

View File

@ -16,6 +16,7 @@
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
<PackageReference Include="Microsoft.AspNetCore.AspNetCoreModule" Version="$(MicrosoftAspNetCoreAspNetCoreModulePackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.AspNetCoreModuleV2" Version="$(MicrosoftAspNetCoreAspNetCoreModuleV2PackageVersion)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)'=='.NETCoreApp' AND '$(Configuration)' == 'RuntimeStore' ">
@ -35,6 +36,7 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(MicrosoftAspNetCoreMvcPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation" PrivateAssets="All" Version="$(MicrosoftAspNetCoreMvcRazorViewCompilationPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Server.HttpSys" Version="$(MicrosoftAspNetCoreServerHttpSysPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Server.IIS" Version="$(MicrosoftAspNetCoreServerIISPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Session" Version="$(MicrosoftAspNetCoreSessionPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(MicrosoftAspNetCoreStaticFilesPackageVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(MicrosoftEntityFrameworkCoreInMemoryPackageVersion)" />

View File

@ -50,6 +50,9 @@ namespace MusicStore
builder.UseKestrel();
}
// In Proc
builder.UseIIS();
builder.ConfigureLogging(factory =>
{
factory.AddConsole();

File diff suppressed because it is too large Load Diff

View File

@ -177,6 +177,8 @@
<system.webServer>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" hostingModel="[HostingModel]" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
<serverRuntime />
<asp scriptErrorSentToBrowser="true">
@ -931,6 +933,7 @@
<add name="AspNetCoreModule" />
</modules>
<handlers accessPolicy="Read, Script">
<add name="aspNetCore" path="*" verb="*" modules="[AspNetCoreModule]" resourceType="Unspecified" />
<!-- <add name="WebDAV" path="*" verb="PROPFIND,PROPPATCH,MKCOL,PUT,COPY,DELETE,MOVE,LOCK,UNLOCK" modules="WebDAVModule" resourceType="Unspecified" requireAccess="None" /> -->
<add name="AXD-ISAPI-4.0_64bit" path="*.axd" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="PageHandlerFactory-ISAPI-4.0_64bit" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />

View File

@ -34,10 +34,9 @@ namespace E2ETests
var deploymentParameters = new DeploymentParameters(variant)
{
ApplicationPath = Helpers.GetApplicationPath(),
PublishApplicationBeforeDeployment = true,
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
EnvironmentName = "NtlmAuthentication", //Will pick the Start class named 'StartupNtlmAuthentication'
ServerConfigTemplateContent = (variant.Server == ServerType.IISExpress) ? File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "NtlmAuthentation.config")) : null,
ServerConfigTemplateContent = Helpers.GetConfigContent(variant.Server, "NtlmAuthentation.config"),
SiteName = "MusicStoreNtlmAuthentication", //This is configured in the NtlmAuthentication.config
UserAdditionalCleanup = parameters =>
{

View File

@ -30,10 +30,7 @@ namespace E2ETests
var deploymentParameters = new DeploymentParameters(variant)
{
ApplicationPath = Helpers.GetApplicationPath(),
PublishApplicationBeforeDeployment = true,
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
ServerConfigTemplateContent = Helpers.GetConfigContent(variant.Server, "Http.config"),
SiteName = "MusicStoreTestSite",
EnvironmentName = "OpenIdConnectTesting",
UserAdditionalCleanup = parameters =>
{

View File

@ -18,6 +18,8 @@ namespace E2ETests
=> TestMatrix.ForServers(ServerType.IISExpress, ServerType.Kestrel, ServerType.HttpSys)
.WithTfms(Tfm.NetCoreApp22, Tfm.NetCoreApp21, Tfm.NetCoreApp20, Tfm.Net461)
.WithAllApplicationTypes()
.WithAllAncmVersions()
.WithAllHostingModels()
.WithAllArchitectures();
[ConditionalTheory]
@ -35,8 +37,6 @@ namespace E2ETests
ApplicationPath = Helpers.GetApplicationPath(),
PublishApplicationBeforeDeployment = true,
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
ServerConfigTemplateContent = Helpers.GetConfigContent(variant.Server, "Http.config"),
SiteName = "MusicStoreTestSite",
UserAdditionalCleanup = parameters =>
{
DbUtils.DropDatabase(musicStoreDbName, logger);

View File

@ -18,7 +18,9 @@ namespace E2ETests
public static TestMatrix TestVariants
=> TestMatrix.ForServers(ServerType.IISExpress, ServerType.Kestrel, ServerType.HttpSys)
.WithTfms(Tfm.NetCoreApp22, Tfm.NetCoreApp21, Tfm.NetCoreApp20, Tfm.Net461)
.WithAllApplicationTypes();
.WithAllApplicationTypes()
.WithAllAncmVersions()
.WithAllHostingModels();
[ConditionalTheory]
[MemberData(nameof(TestVariants))]
@ -34,9 +36,6 @@ namespace E2ETests
{
ApplicationPath = Helpers.GetApplicationPath(),
EnvironmentName = "SocialTesting",
ServerConfigTemplateContent = Helpers.GetConfigContent(variant.Server, "Http.config"),
SiteName = "MusicStoreTestSite",
PublishApplicationBeforeDeployment = true,
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
UserAdditionalCleanup = parameters =>
{

View File

@ -32,11 +32,9 @@ namespace E2ETests
Helpers.GetApplicationPath(), serverType, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64)
{
EnvironmentName = "SocialTesting",
SiteName = "MusicStoreTestSiteUsingStore",
PublishApplicationBeforeDeployment = true,
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
TargetFramework = Tfm.NetCoreApp20, // There's only a Store on 2.0
ApplicationType = ApplicationType.Portable,
UserAdditionalCleanup = parameters =>
{
DbUtils.DropDatabase(musicStoreDbName, logger);