Merge pull request #1141 from dotnet-maestro-bot/merge/release/2.2-to-master

[automated] Merge branch 'release/2.2' => 'master'
This commit is contained in:
Pavel Krymets 2018-08-03 15:33:21 -07:00 committed by GitHub
commit 92cca2381f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 126 additions and 101 deletions

View File

@ -5,6 +5,14 @@ phases:
beforeBuild:
- powershell: "& ./tools/UpdateIISExpressCertificate.ps1; & ./tools/update_schema.ps1; Restart-Service w3svc"
displayName: Prepare repo
afterBuild:
- task: PublishBuildArtifacts@1
displayName: Upload binlog
condition: always()
inputs:
artifactName: logs
artifactType: Container
pathtoPublish: artifacts/logs/
- template: .vsts-pipelines/templates/phases/default-build.yml@buildtools
parameters:

View File

@ -92,7 +92,7 @@
<AncmFiles Include="%(Components.PdbLocation)" Link="%(Components.BaseOutputPath)\%(Components.Platform)\%(Components.NativeAsset).pdb" />
<!-- Schema-->
<AncmFiles Include="$(SourceBase)AspNetCoreModuleV1\AspNetCore\aspnetcore_schema.xml" Link="AspNetCoreModuleV1\aspnetcore_schema.xml" />
<AncmFiles Include="$(SourceBase)AspNetCoreModuleV2\AspNetCore\aspnetcore_schema_v2.xml" Link="AspNetCoreModuleV1\aspnetcore_schema.xml" />
<AncmFiles Include="$(SourceBase)AspNetCoreModuleV2\AspNetCore\aspnetcore_schema_v2.xml" Link="AspNetCoreModuleV2\aspnetcore_schema_v2.xml" />
<AncmFiles Include="$(SourceBase)AspNetCoreModuleV2\AspNetCore\ancm.mof" Link="AspNetCoreModuleV2\ancm.mof" />
</ItemGroup>

View File

@ -25,7 +25,7 @@
<file src="src\AspNetCoreModuleV1\AspNetCore\bin\$Configuration$\Win32\aspnetcore.pdb" target="contentFiles\any\any\x86\" />
<file src="src\AspNetCoreModuleV1\AspNetCore\bin\$Configuration$\x64\aspnetcore.pdb" target="contentFiles\any\any\x64\" />
<file src="src\AspNetCoreModuleV1\AspNetCore\aspnetcore_schema.xml"/>
<file src="src\AspNetCoreModuleV2\AspNetCore\aspnetcore_schema_v2.xml" target="aspnetcore_schema.xml"/>
<file src="tools\installancm.ps1"/>
<file src="LICENSE.txt"/>
<file src="nuget\Microsoft.AspNetCore.AspNetCoreModule.props" target="build\" />

View File

@ -4,6 +4,7 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<InProcessTestSite>true</InProcessTestSite>
</PropertyGroup>
<ItemGroup>

View File

@ -213,14 +213,6 @@
<ItemGroup>
<None Include="Source.def" />
</ItemGroup>
<ItemGroup>
<Content Include="aspnetcore_schema.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Xml Include="aspnetcore_schema.xml" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\application.cxx" />
<ClCompile Include="src\applicationmanager.cxx" />

View File

@ -1,39 +0,0 @@
<!--
IIS Asp.Net Core Extension Schema
** Please DO NOT edit this file yourself. **
If you want to add configuration sections to the schema, you may place
them in .xml files similar to this one, in this directory. They will be
picked up automatically on startup.
-->
<configSchema>
<sectionSchema name="system.webServer/aspNetCore">
<attribute name="processPath" type="string" expanded="true"/>
<attribute name="arguments" type="string" expanded="true" defaultValue=""/>
<attribute name="startupTimeLimit" type="uint" defaultValue="120" validationType="integerRange" validationParameter="0,3600"/> <!-- in seconds -->
<attribute name="shutdownTimeLimit" type="uint" defaultValue="10" validationType="integerRange" validationParameter="0,600"/> <!-- in seconds -->
<attribute name="rapidFailsPerMinute" type="uint" defaultValue="10" validationType="integerRange" validationParameter="0,100"/>
<attribute name="requestTimeout" type="timeSpan" defaultValue="00:02:00" validationType="timeSpanRange" validationParameter="0,1296000,60"/>
<attribute name="stdoutLogEnabled" type="bool" defaultValue="false" />
<attribute name="stdoutLogFile" type="string" defaultValue=".\aspnetcore-stdout" expanded="true"/>
<attribute name="processesPerApplication" type="uint" defaultValue="1" validationType="integerRange" validationParameter="1,100"/>
<attribute name="forwardWindowsAuthToken" type="bool" defaultValue="true" />
<attribute name="disableStartUpErrorPage" type="bool" defaultValue="false" />
<attribute name="hostingModel" type="string" />
<element name="recycleOnFileChange">
<collection addElement="file" clearElement="clear">
<attribute name="path" type="string" required="true" validationType="nonEmptyString" expanded="true"/>
</collection>
</element>
<element name="environmentVariables">
<collection addElement="environmentVariable" clearElement="clear" >
<attribute name="name" type="string" required="true" validationType="nonEmptyString"/>
<attribute name="value" type="string" required="true"/>
</collection>
</element>
</sectionSchema>
</configSchema>

View File

@ -44,24 +44,40 @@ APPLICATION_MANAGER::GetOrCreateApplicationInfo(
// key in the applicationInfoHash.
pszApplicationId = pApplication.GetApplicationId();
// When accessing the m_pApplicationInfoHash, we need to acquire the application manager
// lock to avoid races on setting state.
SRWSharedLock lock(m_srwLock);
if (!m_fDebugInitialize)
{
DebugInitializeFromConfig(m_pHttpServer, pApplication);
m_fDebugInitialize = TRUE;
}
// When accessing the m_pApplicationInfoHash, we need to acquire the application manager
// lock to avoid races on setting state.
SRWSharedLock readLock(m_srwLock);
if (!m_fDebugInitialize)
{
DebugInitializeFromConfig(m_pHttpServer, pApplication);
m_fDebugInitialize = TRUE;
}
if (g_fInShutdown)
{
FINISHED(HRESULT_FROM_WIN32(ERROR_SERVER_SHUTDOWN_IN_PROGRESS));
}
if (g_fInShutdown)
{
FINISHED(HRESULT_FROM_WIN32(ERROR_SERVER_SHUTDOWN_IN_PROGRESS));
}
m_pApplicationInfoHash->FindKey(pszApplicationId, ppApplicationInfo);
m_pApplicationInfoHash->FindKey(pszApplicationId, ppApplicationInfo);
// It's important to release read lock here so exclusive lock
// can be reacquired later as SRW lock doesn't allow upgrades
}
if (*ppApplicationInfo == NULL)
{
// Take exclusive lock before creating the application
SRWExclusiveLock writeLock(m_srwLock);
// Check if other thread created the application
m_pApplicationInfoHash->FindKey(pszApplicationId, ppApplicationInfo);
if (*ppApplicationInfo != NULL)
{
FINISHED(S_OK);
}
pApplicationInfo = new APPLICATION_INFO(m_pHttpServer);
FINISHED_IF_FAILED(pApplicationInfo->Initialize(pApplication));
@ -187,7 +203,7 @@ APPLICATION_MANAGER::RecycleApplicationFromManager(
DWORD dwPreviousCounter = 0;
APPLICATION_INFO_HASH* table = NULL;
CONFIG_CHANGE_CONTEXT context;
if (g_fInShutdown)
{
// We are already shutting down, ignore this event as a global configuration change event

View File

@ -6,7 +6,7 @@
#include "GlobalVersionUtility.h"
namespace fs = std::experimental::filesystem;
namespace fs = std::filesystem;
// throws runtime error if no request handler versions are installed.
// Throw invalid_argument if any argument is null

View File

@ -38,7 +38,7 @@ PollingAppOfflineApplication::AppOfflineExists()
}
std::experimental::filesystem::path PollingAppOfflineApplication::GetAppOfflineLocation(IHttpApplication& pApplication)
std::filesystem::path PollingAppOfflineApplication::GetAppOfflineLocation(IHttpApplication& pApplication)
{
return std::experimental::filesystem::path(pApplication.GetApplicationPhysicalPath()) / "app_offline.htm";
return std::filesystem::path(pApplication.GetApplicationPhysicalPath()) / "app_offline.htm";
}

View File

@ -30,8 +30,8 @@ public:
void Stop(bool fServerInitiated) override { UNREFERENCED_PARAMETER(fServerInitiated); }
protected:
std::experimental::filesystem::path m_appOfflineLocation;
static std::experimental::filesystem::path GetAppOfflineLocation(IHttpApplication& pApplication);
std::filesystem::path m_appOfflineLocation;
static std::filesystem::path GetAppOfflineLocation(IHttpApplication& pApplication);
private:
static const int c_appOfflineRefreshIntervalMS = 200;

View File

@ -13,7 +13,7 @@
#include "HandleWrapper.h"
#include "Environment.h"
namespace fs = std::experimental::filesystem;
namespace fs = std::filesystem;
//
// Runs a standalone appliction.
@ -98,7 +98,7 @@ HOSTFXR_UTILITY::GetStandaloneHostfxrParameters(
}
BOOL
HOSTFXR_UTILITY::IsDotnetExecutable(const std::experimental::filesystem::path & dotnetPath)
HOSTFXR_UTILITY::IsDotnetExecutable(const std::filesystem::path & dotnetPath)
{
auto name = dotnetPath.filename();
name.replace_extension("");

View File

@ -44,7 +44,7 @@ public:
static
BOOL
IsDotnetExecutable(
_In_ const std::experimental::filesystem::path & dotnetPath
_In_ const std::filesystem::path & dotnetPath
);
static
@ -74,25 +74,25 @@ public:
);
static
std::optional<std::experimental::filesystem::path>
std::optional<std::filesystem::path>
GetAbsolutePathToHostFxr(
_In_ const std::experimental::filesystem::path & dotnetPath,
_In_ const std::filesystem::path & dotnetPath,
_In_ HANDLE hEventLog
);
static
std::optional<std::experimental::filesystem::path>
std::optional<std::filesystem::path>
GetAbsolutePathToDotnetFromProgramFiles();
static
std::optional<std::experimental::filesystem::path>
std::optional<std::filesystem::path>
InvokeWhereToFindDotnet();
static
std::optional<std::experimental::filesystem::path>
std::optional<std::filesystem::path>
GetAbsolutePathToDotnet(
_In_ const std::experimental::filesystem::path & applicationPath,
_In_ const std::experimental::filesystem::path & requestedPath
_In_ const std::filesystem::path & applicationPath,
_In_ const std::filesystem::path & requestedPath
);
};

View File

@ -34,9 +34,7 @@
<None Include="%(InProcessComponents.DllLocation)"
Pack="true"
PackagePath="runtimes/win-%(InProcessComponents.Platform)/nativeassets/$(NativeAssetsTargetFramework)" />
<None Include="%(InProcessComponents.PdbLocation)"
Pack="true"
PackagePath="runtimes/win-%(InProcessComponents.Platform)/nativeassets/$(NativeAssetsTargetFramework)" />
<SignedPackageFile Include="%(InProcessComponents.NativeAsset)_%(InProcessComponents.Platform)"
PackagePath="runtimes/win-%(InProcessComponents.Platform)/nativeassets/$(NativeAssetsTargetFramework)/%(InProcessComponents.NativeAsset).dll"
Certificate="Microsoft" />

View File

@ -7,7 +7,7 @@
</ItemGroup>
<PropertyGroup>
<AspNetCoreModuleVersion Condition=" '$(AspNetCoreModuleVersion)' == '' ">V2</AspNetCoreModuleVersion>
<AspNetCoreModuleName Condition=" '$(AspNetCoreModuleName)' == '' ">AspNetCoreModuleV2</AspNetCoreModuleName>
</PropertyGroup>
</Project>

View File

@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<AspNetCoreModuleVersion Condition=" '$(AspNetCoreModuleVersion)' == '' ">V2</AspNetCoreModuleVersion>
<AspNetCoreModuleName Condition=" '$(AspNetCoreModuleName)' == '' ">AspNetCoreModuleV2</AspNetCoreModuleName>
</PropertyGroup>
</Project>

View File

@ -20,6 +20,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
internal class IISApplication
{
internal const int ERROR_OBJECT_NOT_FOUND = unchecked((int)0x800710D8);
internal const int ERROR_SHARING_VIOLATION = unchecked((int)0x80070020);
private static readonly TimeSpan _timeout = TimeSpan.FromSeconds(10);
private static readonly TimeSpan _retryDelay = TimeSpan.FromMilliseconds(200);
@ -109,7 +110,10 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting
_logger.LogInformation($"Tried to start site, state: {state.ToString()}");
}
}
catch (Exception ex) when (ex is DllNotFoundException || (ex is COMException && ex.HResult == ERROR_OBJECT_NOT_FOUND) )
catch (Exception ex) when (
ex is DllNotFoundException ||
ex is COMException &&
(ex.HResult == ERROR_OBJECT_NOT_FOUND || ex.HResult == ERROR_SHARING_VIOLATION))
{
// Accessing the site.State property while the site
// is starting up returns the COMException

View File

@ -27,10 +27,6 @@
PackageCopyToOutput="true"
PackagePath="contentFiles/any/any/%(ShimComponents.Platform)/%(ShimComponents.PackageSubPath)"/>
<Content Include="%(ShimComponents.PdbLocation)"
PackageCopyToOutput="true"
PackagePath="contentFiles/any/any/%(ShimComponents.Platform)/%(ShimComponents.PackageSubPath)" />
<SignedPackageFile Include="%(ShimComponents.NativeAsset)_%(ShimComponents.Platform)"
PackagePath="contentFiles/any/any/%(ShimComponents.Platform)/%(ShimComponents.PackageSubPath)%(ShimComponents.NativeAsset).dll"
Certificate="Microsoft" />

View File

@ -1,6 +1,7 @@
// 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;
@ -19,6 +20,8 @@ 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)
@ -94,7 +97,7 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
// 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(100);
await Task.Delay(RetryDelay);
AddAppOffline(deploymentResult.ContentRoot);
@ -182,7 +185,7 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
() => AddAppOffline(deploymentResult.ContentRoot),
e => Logger.LogError($"Failed to create app_offline : {e.Message}"),
retryCount: 3,
retryDelayMilliseconds: 100);
retryDelayMilliseconds: RetryDelay.Milliseconds);
RemoveAppOffline(deploymentResult.ContentRoot);
}
@ -218,7 +221,7 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
() => File.Delete(Path.Combine(appPath, "app_offline.htm")),
e => Logger.LogError($"Failed to remove app_offline : {e.Message}"),
retryCount: 3,
retryDelayMilliseconds: 100);
retryDelayMilliseconds: RetryDelay.Milliseconds);
}
private async Task AssertAppOffline(IISDeploymentResult deploymentResult, string expectedResponse = "The app is offline.")
@ -229,6 +232,7 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests
{
// Keep retrying until app_offline is present.
response = await deploymentResult.HttpClient.GetAsync("HelloWorld");
await Task.Delay(RetryDelay);
}
Assert.Equal(HttpStatusCode.ServiceUnavailable, response.StatusCode);

View File

@ -0,0 +1,48 @@
// 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.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 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());
});
}
}
}

View File

@ -41,7 +41,7 @@ namespace FileOutManagerStartupTests
wprintf(expected, out);
}
for (auto & p : std::experimental::filesystem::directory_iterator(tempDirectory.path()))
for (auto & p : std::filesystem::directory_iterator(tempDirectory.path()))
{
std::wstring filename(p.path().filename());
ASSERT_EQ(filename.substr(0, fileNamePrefix.size()), fileNamePrefix);

View File

@ -7,7 +7,7 @@
namespace GlobalVersionTests
{
using ::testing::Test;
namespace fs = std::experimental::filesystem;
namespace fs = std::filesystem;
class GlobalVersionTest : public Test
{

View File

@ -28,7 +28,7 @@ TempDirectory::TempDirectory()
RPC_CSTR szUuid = NULL;
if (UuidToStringA(&uuid, &szUuid) == RPC_S_OK)
{
m_path = std::experimental::filesystem::temp_directory_path() / szUuid;
m_path = std::filesystem::temp_directory_path() / reinterpret_cast<PCHAR>(szUuid);
RpcStringFreeA(&szUuid);
return;
}
@ -37,5 +37,5 @@ TempDirectory::TempDirectory()
TempDirectory::~TempDirectory()
{
std::experimental::filesystem::remove_all(m_path);
std::filesystem::remove_all(m_path);
}

View File

@ -18,11 +18,11 @@ public:
~TempDirectory();
std::experimental::filesystem::path path() const
std::filesystem::path path() const
{
return m_path;
}
private:
std::experimental::filesystem::path m_path;
std::filesystem::path m_path;
};

View File

@ -15,10 +15,7 @@ $ancmSchemaFiles = @(
"aspnetcore_schema_v2.xml"
)
$ancmSchemaFileLocations = @(
@(Resolve-Path "$PSScriptRoot\..\src\AspNetCoreModuleV1\AspNetCore\aspnetcore_schema.xml"),
@(Resolve-Path "$PSScriptRoot\..\src\AspNetCoreModuleV2\AspNetCore\aspnetcore_schema_v2.xml")
)
$ancmSchemaFileLocation = Resolve-Path "$PSScriptRoot\..\src\AspNetCoreModuleV2\AspNetCore\aspnetcore_schema_v2.xml";
[bool]$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
@ -46,7 +43,7 @@ if (-not $isAdmin -and -not $WhatIfPreference) {
for ($i=0; $i -lt $ancmSchemaFiles.Length; $i++)
{
$schemaFile = $ancmSchemaFiles[$i]
$schemaSource = $ancmSchemaFileLocations[$i]
$schemaSource = $ancmSchemaFileLocation
$destinations = @(
"${env:ProgramFiles(x86)}\IIS Express\config\schema\",