Add OutOfProc logging tests/ merge all inproc test sites into a single site (#1384)
This commit is contained in:
parent
9eb706e694
commit
3649f5bb81
|
|
@ -75,8 +75,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestTasks", "test\TestTasks
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebSites", "WebSites", "{744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OverriddenServerWebSite", "test\WebSites\OverriddenServerWebSite\OverriddenServerWebSite.csproj", "{FC2A97F8-A749-4C04-97D1-97500066A820}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonLibTests", "test\CommonLibTests\CommonLibTests.vcxproj", "{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AspNetCoreModuleV2", "AspNetCoreModuleV2", "{06CA2C2B-83B0-4D83-905A-E0C74790009E}"
|
||||
|
|
@ -103,8 +101,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InProcessRequestHandler", "
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OutOfProcessRequestHandler", "src\AspNetCoreModuleV2\OutOfProcessRequestHandler\OutOfProcessRequestHandler.vcxproj", "{7F87406C-A3C8-4139-A68D-E4C344294A67}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StartupExceptionWebSite", "test\WebSites\StartupExceptionWebSite\StartupExceptionWebSite.csproj", "{340C59FC-C682-4CBA-81F8-791821EC8EDE}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest", "test\gtest\gtest.vcxproj", "{CAC1267B-8778-4257-AAC6-CAF481723B01}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RequestHandlerLib", "src\AspNetCoreModuleV2\RequestHandlerLib\RequestHandlerLib.vcxproj", "{1533E271-F61B-441B-8B74-59FB61DF0552}"
|
||||
|
|
@ -235,18 +231,6 @@ Global
|
|||
{064D860B-4D7C-4B1D-918F-E020F1B99E2A}.Release|x64.Build.0 = Release|Any CPU
|
||||
{064D860B-4D7C-4B1D-918F-E020F1B99E2A}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{064D860B-4D7C-4B1D-918F-E020F1B99E2A}.Release|x86.Build.0 = Release|Any CPU
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Debug|x64.Build.0 = Debug|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Debug|x86.Build.0 = Debug|x86
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|Any CPU.Build.0 = Release|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x64.ActiveCfg = Release|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x64.Build.0 = Release|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x86.ActiveCfg = Release|x86
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x86.Build.0 = Release|x86
|
||||
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|x64.Build.0 = Debug|x64
|
||||
|
|
@ -331,16 +315,6 @@ Global
|
|||
{7F87406C-A3C8-4139-A68D-E4C344294A67}.Release|x64.Build.0 = Release|x64
|
||||
{7F87406C-A3C8-4139-A68D-E4C344294A67}.Release|x86.ActiveCfg = Release|Win32
|
||||
{7F87406C-A3C8-4139-A68D-E4C344294A67}.Release|x86.Build.0 = Release|Win32
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Debug|x64.Build.0 = Debug|x64
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Debug|x86.Build.0 = Debug|x86
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Release|x64.ActiveCfg = Release|x64
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Release|x64.Build.0 = Release|x64
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Release|x86.ActiveCfg = Release|x86
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Release|x86.Build.0 = Release|x86
|
||||
{CAC1267B-8778-4257-AAC6-CAF481723B01}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{CAC1267B-8778-4257-AAC6-CAF481723B01}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{CAC1267B-8778-4257-AAC6-CAF481723B01}.Debug|x64.Build.0 = Debug|x64
|
||||
|
|
@ -424,7 +398,6 @@ Global
|
|||
{13FD8F12-FFBE-4D01-B4AC-444F2994B04F} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}
|
||||
{064D860B-4D7C-4B1D-918F-E020F1B99E2A} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||
{744ACDC6-F6A0-4FF9-9421-F25C5F2DC520} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}
|
||||
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||
{06CA2C2B-83B0-4D83-905A-E0C74790009E} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
|
||||
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B} = {06CA2C2B-83B0-4D83-905A-E0C74790009E}
|
||||
|
|
@ -434,7 +407,6 @@ Global
|
|||
{48F46909-E76A-4788-BCE1-E543C0E140FE} = {622D35C9-627B-466E-8D15-752968CC79AF}
|
||||
{D57EA297-6DC2-4BC0-8C91-334863327863} = {06CA2C2B-83B0-4D83-905A-E0C74790009E}
|
||||
{7F87406C-A3C8-4139-A68D-E4C344294A67} = {06CA2C2B-83B0-4D83-905A-E0C74790009E}
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}
|
||||
{CAC1267B-8778-4257-AAC6-CAF481723B01} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||
{1533E271-F61B-441B-8B74-59FB61DF0552} = {06CA2C2B-83B0-4D83-905A-E0C74790009E}
|
||||
{D182103F-8405-4647-B158-C36F598657EF} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||
|
|
|
|||
|
|
@ -77,8 +77,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestTasks", "test\TestTasks
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebSites", "WebSites", "{744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OverriddenServerWebSite", "test\WebSites\OverriddenServerWebSite\OverriddenServerWebSite.csproj", "{FC2A97F8-A749-4C04-97D1-97500066A820}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonLibTests", "test\CommonLibTests\CommonLibTests.vcxproj", "{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AspNetCoreModuleV1", "AspNetCoreModuleV1", "{16E521CE-77F1-4B1C-A183-520A41C4F372}"
|
||||
|
|
@ -111,8 +109,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InProcessRequestHandler", "
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OutOfProcessRequestHandler", "src\AspNetCoreModuleV2\OutOfProcessRequestHandler\OutOfProcessRequestHandler.vcxproj", "{7F87406C-A3C8-4139-A68D-E4C344294A67}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StartupExceptionWebSite", "test\WebSites\StartupExceptionWebSite\StartupExceptionWebSite.csproj", "{340C59FC-C682-4CBA-81F8-791821EC8EDE}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest", "test\gtest\gtest.vcxproj", "{CAC1267B-8778-4257-AAC6-CAF481723B01}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RequestHandlerLib", "src\AspNetCoreModuleV2\RequestHandlerLib\RequestHandlerLib.vcxproj", "{1533E271-F61B-441B-8B74-59FB61DF0552}"
|
||||
|
|
@ -321,26 +317,6 @@ Global
|
|||
{064D860B-4D7C-4B1D-918F-E020F1B99E2A}.Release|x64.Build.0 = Release|Any CPU
|
||||
{064D860B-4D7C-4B1D-918F-E020F1B99E2A}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{064D860B-4D7C-4B1D-918F-E020F1B99E2A}.Release|x86.Build.0 = Release|Any CPU
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Debug|Any CPU.ActiveCfg = Debug|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Debug|Any CPU.Build.0 = Debug|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Debug|x64.Build.0 = Debug|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Debug|x86.Build.0 = Debug|x86
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.NativeDebug|Any CPU.ActiveCfg = Debug|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.NativeDebug|Any CPU.Build.0 = Debug|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.NativeDebug|x64.ActiveCfg = Debug|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.NativeDebug|x86.ActiveCfg = Debug|x86
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.NativeRelease|Any CPU.ActiveCfg = Release|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.NativeRelease|Any CPU.Build.0 = Release|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.NativeRelease|x64.ActiveCfg = Release|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.NativeRelease|x86.ActiveCfg = Release|x86
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|Any CPU.ActiveCfg = Release|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|Any CPU.Build.0 = Release|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x64.ActiveCfg = Release|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x64.Build.0 = Release|x64
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x86.ActiveCfg = Release|x86
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820}.Release|x86.Build.0 = Release|x86
|
||||
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1}.Debug|x64.Build.0 = Debug|x64
|
||||
|
|
@ -541,22 +517,6 @@ Global
|
|||
{7F87406C-A3C8-4139-A68D-E4C344294A67}.Release|x64.Build.0 = Release|x64
|
||||
{7F87406C-A3C8-4139-A68D-E4C344294A67}.Release|x86.ActiveCfg = Release|Win32
|
||||
{7F87406C-A3C8-4139-A68D-E4C344294A67}.Release|x86.Build.0 = Release|Win32
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Debug|x64.Build.0 = Debug|x64
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Debug|x86.Build.0 = Debug|x86
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.NativeDebug|Any CPU.ActiveCfg = Debug|x86
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.NativeDebug|x64.ActiveCfg = Debug|x64
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.NativeDebug|x86.ActiveCfg = Debug|x86
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.NativeRelease|Any CPU.ActiveCfg = Release|x86
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.NativeRelease|x64.ActiveCfg = Release|x64
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.NativeRelease|x86.ActiveCfg = Release|x86
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Release|x64.ActiveCfg = Release|x64
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Release|x64.Build.0 = Release|x64
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Release|x86.ActiveCfg = Release|x86
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE}.Release|x86.Build.0 = Release|x86
|
||||
{CAC1267B-8778-4257-AAC6-CAF481723B01}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
||||
{CAC1267B-8778-4257-AAC6-CAF481723B01}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{CAC1267B-8778-4257-AAC6-CAF481723B01}.Debug|x64.Build.0 = Debug|x64
|
||||
|
|
@ -692,7 +652,6 @@ Global
|
|||
{13FD8F12-FFBE-4D01-B4AC-444F2994B04F} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}
|
||||
{064D860B-4D7C-4B1D-918F-E020F1B99E2A} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||
{744ACDC6-F6A0-4FF9-9421-F25C5F2DC520} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||
{FC2A97F8-A749-4C04-97D1-97500066A820} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}
|
||||
{1EAC8125-1765-4E2D-8CBE-56DC98A1C8C1} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||
{16E521CE-77F1-4B1C-A183-520A41C4F372} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
|
||||
{06CA2C2B-83B0-4D83-905A-E0C74790009E} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
|
||||
|
|
@ -705,7 +664,6 @@ Global
|
|||
{48F46909-E76A-4788-BCE1-E543C0E140FE} = {622D35C9-627B-466E-8D15-752968CC79AF}
|
||||
{D57EA297-6DC2-4BC0-8C91-334863327863} = {06CA2C2B-83B0-4D83-905A-E0C74790009E}
|
||||
{7F87406C-A3C8-4139-A68D-E4C344294A67} = {06CA2C2B-83B0-4D83-905A-E0C74790009E}
|
||||
{340C59FC-C682-4CBA-81F8-791821EC8EDE} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}
|
||||
{CAC1267B-8778-4257-AAC6-CAF481723B01} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||
{1533E271-F61B-441B-8B74-59FB61DF0552} = {06CA2C2B-83B0-4D83-905A-E0C74790009E}
|
||||
{1F0C8D9B-F47B-41F3-9FC9-6954B6DC7712} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,13 @@
|
|||
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Server.IISIntegration\Microsoft.AspNetCore.Server.IISIntegration.csproj" />
|
||||
<ProjectReference Include="..\..\test\IISExpress.FunctionalTests\IISExpress.FunctionalTests.csproj" />
|
||||
<ProjectReference Include="..\..\test\IIS.Tests\IIS.Tests.csproj" />
|
||||
<ProjectReference Include="..\..\test\WebSites\**\*.csproj">
|
||||
<ProjectReference Include="..\..\test\WebSites\InProcessWebSite\InProcessWebSite.csproj">
|
||||
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\test\WebSites\OutOfProcessWebSite\OutOfProcessWebSite.csproj">
|
||||
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\test\WebSites\StressTestWebSite\StressTestWebSite.csproj">
|
||||
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -115,6 +115,10 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
|
|||
|
||||
protected override IEnumerable<Action<XElement, string>> GetWebConfigActions()
|
||||
{
|
||||
yield return WebConfigHelpers.AddOrModifyAspNetCoreSection(
|
||||
key: "hostingModel",
|
||||
value: DeploymentParameters.HostingModel.ToString());
|
||||
|
||||
if (DeploymentParameters.ApplicationType == ApplicationType.Portable)
|
||||
{
|
||||
yield return WebConfigHelpers.AddOrModifyAspNetCoreSection(
|
||||
|
|
@ -126,15 +130,12 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
|
|||
key: "modules",
|
||||
value: DeploymentParameters.AncmVersion.ToString());
|
||||
|
||||
|
||||
foreach (var action in base.GetWebConfigActions())
|
||||
{
|
||||
yield return action;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void GetLogsFromFile()
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS
|
|||
// For published apps, prefer the content in the web.config, but update it.
|
||||
yield return WebConfigHelpers.AddOrModifyAspNetCoreSection(
|
||||
key: "hostingModel",
|
||||
value: DeploymentParameters.HostingModel == HostingModel.InProcess ? "inprocess" : "");
|
||||
value: DeploymentParameters.HostingModel.ToString());
|
||||
|
||||
yield return WebConfigHelpers.AddOrModifyHandlerSection(
|
||||
key: "modules",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,85 @@
|
|||
// 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.IO;
|
||||
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 LogPipeTests : IISFunctionalTestBase
|
||||
{
|
||||
private readonly PublishedSitesFixture _fixture;
|
||||
|
||||
public LogPipeTests(PublishedSitesFixture fixture)
|
||||
{
|
||||
_fixture = fixture;
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[InlineData("ConsoleErrorWrite")]
|
||||
[InlineData("ConsoleWrite")]
|
||||
public async Task CheckStdoutLoggingToPipe_DoesNotCrashProcess(string path)
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
await Helpers.AssertStarts(deploymentResult, path);
|
||||
|
||||
StopServer();
|
||||
|
||||
if (deploymentParameters.ServerType == ServerType.IISExpress)
|
||||
{
|
||||
Assert.Contains(TestSink.Writes, context => context.Message.Contains("TEST MESSAGE"));
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[InlineData("ConsoleErrorWrite")]
|
||||
[InlineData("ConsoleWrite")]
|
||||
public async Task CheckStdoutLoggingToPipeWithFirstWrite(string path)
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||
|
||||
var firstWriteString = path + path;
|
||||
|
||||
deploymentParameters.WebConfigBasedEnvironmentVariables["ASPNETCORE_INPROCESS_INITIAL_WRITE"] = firstWriteString;
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
await Helpers.AssertStarts(deploymentResult, path);
|
||||
|
||||
StopServer();
|
||||
|
||||
if (deploymentParameters.ServerType == ServerType.IISExpress)
|
||||
{
|
||||
// We can't read stdout logs from IIS as they aren't redirected.
|
||||
Assert.Contains(TestSink.Writes, context => context.Message.Contains(firstWriteString));
|
||||
Assert.Contains(TestSink.Writes, context => context.Message.Contains("TEST MESSAGE"));
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task CheckUnicodePipe()
|
||||
{
|
||||
var path = "CheckConsoleFunctions";
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true);
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} {path}");
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
var response = await deploymentResult.HttpClient.GetAsync(path);
|
||||
|
||||
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
|
||||
|
||||
StopServer();
|
||||
EventLogHelpers.VerifyEventLogEvent(deploymentResult, EventLogHelpers.InProcessThreadExitStdOut(deploymentResult, "12", "(.*)彡⾔(.*)"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -22,11 +22,11 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[InlineData("CheckLogFile")]
|
||||
[InlineData("CheckErrLogFile")]
|
||||
[InlineData("ConsoleWrite")]
|
||||
[InlineData("ConsoleErrorWrite")]
|
||||
public async Task CheckStdoutWithRandomNumber(string mode)
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.StartupExceptionWebsite, publish: true);
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true);
|
||||
|
||||
var randomNumberString = new Random(Guid.NewGuid().GetHashCode()).Next(10000000).ToString();
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} {mode} {randomNumberString}");
|
||||
|
|
@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
[InlineData("CheckOversizedStdOutWrites")]
|
||||
public async Task CheckStdoutWithLargeWrites(string mode)
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.StartupExceptionWebsite, publish: true);
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true);
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} {mode}");
|
||||
|
||||
await AssertFailsToStart(deploymentParameters);
|
||||
|
|
@ -54,7 +54,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
[ConditionalFact]
|
||||
public async Task CheckValidConsoleFunctions()
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.StartupExceptionWebsite, publish: true);
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true);
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} CheckConsoleFunctions");
|
||||
|
||||
await AssertFailsToStart(deploymentParameters);
|
||||
|
|
@ -62,7 +62,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
Assert.Contains(TestSink.Writes, context => context.Message.Contains("Is Console redirection: True"));
|
||||
}
|
||||
|
||||
private async Task AssertFailsToStart(IntegrationTesting.IIS.IISDeploymentParameters deploymentParameters)
|
||||
private async Task AssertFailsToStart(IISDeploymentParameters deploymentParameters)
|
||||
{
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
|
|
@ -76,17 +76,17 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
[ConditionalFact]
|
||||
public async Task Gets500_30_ErrorPage()
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.StartupExceptionWebsite, publish: true);
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true);
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} EarlyReturn");
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
var response = await deploymentResult.HttpClient.GetAsync("/");
|
||||
var response = await deploymentResult.HttpClient.GetAsync("/HelloWorld");
|
||||
Assert.False(response.IsSuccessStatusCode);
|
||||
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
|
||||
|
||||
var responseText = await response.Content.ReadAsStringAsync();
|
||||
Assert.Contains("500.30 - ANCM In-Process Start Failure", responseText);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
|
||||
|
|
@ -35,31 +34,49 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
}
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[InlineData("CheckErrLogFile")]
|
||||
[InlineData("CheckLogFile")]
|
||||
public async Task CheckStdoutLoggingToFile(string path)
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||
public static TestMatrix TestVariants
|
||||
=> TestMatrix.ForServers(DeployerSelector.ServerType)
|
||||
.WithTfms(Tfm.NetCoreApp22)
|
||||
.WithAllApplicationTypes()
|
||||
.WithAncmVersions(AncmVersion.AspNetCoreModuleV2)
|
||||
.WithAllHostingModels();
|
||||
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(TestVariants))]
|
||||
public async Task CheckStdoutLoggingToFile(TestVariant variant)
|
||||
{
|
||||
await CheckStdoutToFile(variant, "ConsoleWrite");
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(TestVariants))]
|
||||
public async Task CheckStdoutErrLoggingToFile(TestVariant variant)
|
||||
{
|
||||
await CheckStdoutToFile(variant, "ConsoleErrorWrite");
|
||||
}
|
||||
|
||||
private async Task CheckStdoutToFile(TestVariant variant, string path)
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true);
|
||||
deploymentParameters.EnableLogging(_logFolderPath);
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
await Helpers.AssertStarts(deploymentResult, path);
|
||||
|
||||
await Helpers.AssertStarts(deploymentResult, path);
|
||||
|
||||
StopServer();
|
||||
|
||||
var contents = File.ReadAllText(Helpers.GetExpectedLogName(deploymentResult, _logFolderPath));
|
||||
|
||||
Assert.NotNull(contents);
|
||||
Assert.Contains("TEST MESSAGE", contents);
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task InvalidFilePathForLogs_ServerStillRuns()
|
||||
// Move to separate file
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(TestVariants))]
|
||||
public async Task InvalidFilePathForLogs_ServerStillRuns(TestVariant variant)
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true);
|
||||
|
||||
deploymentParameters.WebConfigActionList.Add(
|
||||
WebConfigHelpers.AddOrModifyAspNetCoreSection("stdoutLogEnabled", "true"));
|
||||
|
|
@ -71,29 +88,18 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
await Helpers.AssertStarts(deploymentResult, "HelloWorld");
|
||||
|
||||
StopServer();
|
||||
EventLogHelpers.VerifyEventLogEvent(deploymentResult, "Could not start stdout redirection in (.*)aspnetcorev2.dll. Exception message: HRESULT 0x80070003");
|
||||
EventLogHelpers.VerifyEventLogEvent(deploymentResult, "Could not stop stdout redirection in (.*)aspnetcorev2.dll. Exception message: HRESULT 0x80070002");
|
||||
if (variant.HostingModel == HostingModel.InProcess)
|
||||
{
|
||||
EventLogHelpers.VerifyEventLogEvent(deploymentResult, "Could not start stdout redirection in (.*)aspnetcorev2.dll. Exception message: HRESULT 0x80070003");
|
||||
EventLogHelpers.VerifyEventLogEvent(deploymentResult, "Could not stop stdout redirection in (.*)aspnetcorev2.dll. Exception message: HRESULT 0x80070002");
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task OnlyOneFileCreatedWithProcessStartTime()
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(TestVariants))]
|
||||
public async Task StartupMessagesAreLoggedIntoDebugLogFile(TestVariant variant)
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||
|
||||
deploymentParameters.EnableLogging(_logFolderPath);
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
await Helpers.AssertStarts(deploymentResult, "CheckLogFile");
|
||||
|
||||
StopServer();
|
||||
|
||||
Assert.Single(Directory.GetFiles(_logFolderPath), Helpers.GetExpectedLogName(deploymentResult, _logFolderPath));
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task StartupMessagesAreLoggedIntoDebugLogFile()
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true);
|
||||
deploymentParameters.HandlerSettings["debugLevel"] = "file";
|
||||
deploymentParameters.HandlerSettings["debugFile"] = "debug.txt";
|
||||
|
||||
|
|
@ -104,10 +110,11 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
AssertLogs(Path.Combine(deploymentResult.ContentRoot, "debug.txt"));
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task StartupMessagesAreLoggedIntoDefaultDebugLogFile()
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(TestVariants))]
|
||||
public async Task StartupMessagesAreLoggedIntoDefaultDebugLogFile(TestVariant variant)
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true);
|
||||
deploymentParameters.HandlerSettings["debugLevel"] = "file";
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
|
@ -117,11 +124,12 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
AssertLogs(Path.Combine(deploymentResult.ContentRoot, "aspnetcore-debug.log"));
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[ConditionalTheory]
|
||||
[RequiresIIS(IISCapability.PoolEnvironmentVariables)]
|
||||
public async Task StartupMessagesAreLoggedIntoDefaultDebugLogFileWhenEnabledWithEnvVar()
|
||||
[MemberData(nameof(TestVariants))]
|
||||
public async Task StartupMessagesAreLoggedIntoDefaultDebugLogFileWhenEnabledWithEnvVar(TestVariant variant)
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true);
|
||||
deploymentParameters.EnvironmentVariables["ASPNETCORE_MODULE_DEBUG"] = "file";
|
||||
// Add empty debugFile handler setting to prevent IIS deployer from overriding debug settings
|
||||
deploymentParameters.HandlerSettings["debugFile"] = "";
|
||||
|
|
@ -133,58 +141,16 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[InlineData("CheckErrLogFile")]
|
||||
[InlineData("CheckLogFile")]
|
||||
public async Task CheckStdoutLoggingToPipe_DoesNotCrashProcess(string path)
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
await Helpers.AssertStarts(deploymentResult, path);
|
||||
|
||||
StopServer();
|
||||
|
||||
if (deploymentParameters.ServerType == ServerType.IISExpress)
|
||||
{
|
||||
Assert.Contains(TestSink.Writes, context => context.Message.Contains("TEST MESSAGE"));
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[InlineData("CheckErrLogFile")]
|
||||
[InlineData("CheckLogFile")]
|
||||
public async Task CheckStdoutLoggingToPipeWithFirstWrite(string path)
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||
|
||||
var firstWriteString = path + path;
|
||||
|
||||
deploymentParameters.WebConfigBasedEnvironmentVariables["ASPNETCORE_INPROCESS_INITIAL_WRITE"] = firstWriteString;
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
await Helpers.AssertStarts(deploymentResult, path);
|
||||
|
||||
StopServer();
|
||||
|
||||
if (deploymentParameters.ServerType == ServerType.IISExpress)
|
||||
{
|
||||
// We can't read stdout logs from IIS as they aren't redirected.
|
||||
Assert.Contains(TestSink.Writes, context => context.Message.Contains(firstWriteString));
|
||||
Assert.Contains(TestSink.Writes, context => context.Message.Contains("TEST MESSAGE"));
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
[RequiresIIS(IISCapability.PoolEnvironmentVariables)]
|
||||
public async Task StartupMessagesLogFileSwitchedWhenLogFilePresentInWebConfig()
|
||||
[MemberData(nameof(TestVariants))]
|
||||
public async Task StartupMessagesLogFileSwitchedWhenLogFilePresentInWebConfig(TestVariant variant)
|
||||
{
|
||||
var firstTempFile = Path.GetTempFileName();
|
||||
var secondTempFile = Path.GetTempFileName();
|
||||
|
||||
try
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true);
|
||||
deploymentParameters.EnvironmentVariables["ASPNETCORE_MODULE_DEBUG_FILE"] = firstTempFile;
|
||||
deploymentParameters.AddDebugLogToWebConfig(secondTempFile);
|
||||
|
||||
|
|
@ -205,68 +171,65 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task DebugLogsAreWrittenToEventLog()
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(TestVariants))]
|
||||
|
||||
public async Task DebugLogsAreWrittenToEventLog(TestVariant variant)
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true);
|
||||
deploymentParameters.HandlerSettings["debugLevel"] = "file,eventlog";
|
||||
var deploymentResult = await StartAsync(deploymentParameters);
|
||||
StopServer();
|
||||
EventLogHelpers.VerifyEventLogEvent(deploymentResult, @"\[aspnetcorev2.dll\] Initializing logs for .*?Description: IIS ASP.NET Core Module V2");
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task OutOfProcessReadsLogConfiguration()
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(hostingModel:HostingModel.OutOfProcess, publish: true);
|
||||
deploymentParameters.HandlerSettings["debugLevel"] = "file,trace";
|
||||
deploymentParameters.HandlerSettings["debugFile"] = "";
|
||||
var deploymentResult = await StartAsync(deploymentParameters);
|
||||
|
||||
var logContents = ReadLogs(Path.Combine(deploymentResult.ContentRoot, "aspnetcore-debug.log"));
|
||||
Assert.Contains("FORWARDING_HANDLER::", logContents);
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task CheckUnicodePipe()
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(TestVariants))]
|
||||
public async Task CheckUTF8File(TestVariant variant)
|
||||
{
|
||||
var path = "CheckConsoleFunctions";
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.StartupExceptionWebsite, publish: true);
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} {path}");
|
||||
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, variant.HostingModel, publish: true);
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} {path}"); // For standalone this will need to remove space
|
||||
|
||||
var logFolderPath = _logFolderPath + "\\彡⾔";
|
||||
deploymentParameters.EnableLogging(logFolderPath);
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
var response = await deploymentResult.HttpClient.GetAsync(path);
|
||||
|
||||
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
|
||||
Assert.False(response.IsSuccessStatusCode);
|
||||
|
||||
StopServer();
|
||||
EventLogHelpers.VerifyEventLogEvent(deploymentResult, EventLogHelpers.InProcessThreadExitStdOut(deploymentResult, "12", "(.*)彡⾔(.*)"));
|
||||
|
||||
var contents = File.ReadAllText(Helpers.GetExpectedLogName(deploymentResult, logFolderPath));
|
||||
Assert.Contains("彡⾔", contents);
|
||||
|
||||
if (variant.HostingModel == HostingModel.InProcess)
|
||||
{
|
||||
EventLogHelpers.VerifyEventLogEvent(deploymentResult, EventLogHelpers.InProcessThreadExitStdOut(deploymentResult, "12", "(.*)彡⾔(.*)"));
|
||||
}
|
||||
else
|
||||
{
|
||||
EventLogHelpers.VerifyEventLogEvent(deploymentResult, EventLogHelpers.OutOfProcessFailedToStart(deploymentResult));
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task CheckUTF8File()
|
||||
[ConditionalTheory]
|
||||
[MemberData(nameof(TestVariants))]
|
||||
public async Task OnlyOneFileCreatedWithProcessStartTime(TestVariant variant)
|
||||
{
|
||||
var path = "CheckConsoleFunctions";
|
||||
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.StartupExceptionWebsite, publish: true);
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} {path}");
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(variant, publish: true);
|
||||
|
||||
deploymentParameters.EnableLogging(_logFolderPath);
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
var response = await deploymentResult.HttpClient.GetAsync(path);
|
||||
|
||||
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
|
||||
await Helpers.AssertStarts(deploymentResult, "ConsoleWrite");
|
||||
|
||||
StopServer();
|
||||
|
||||
var contents = File.ReadAllText(Helpers.GetExpectedLogName(deploymentResult, _logFolderPath));
|
||||
|
||||
Assert.Contains("彡⾔", contents);
|
||||
|
||||
EventLogHelpers.VerifyEventLogEvent(deploymentResult, EventLogHelpers.InProcessThreadExitStdOut(deploymentResult, "12", "(.*)彡⾔(.*)"));
|
||||
Assert.Single(Directory.GetFiles(_logFolderPath), Helpers.GetExpectedLogName(deploymentResult, _logFolderPath));
|
||||
}
|
||||
|
||||
private static string ReadLogs(string logPath)
|
||||
|
|
@ -282,7 +245,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
{
|
||||
var logContents = ReadLogs(logPath);
|
||||
Assert.Contains("[aspnetcorev2.dll]", logContents);
|
||||
Assert.Contains("[aspnetcorev2_inprocess.dll]", logContents);
|
||||
Assert.True(logContents.Contains("[aspnetcorev2_inprocess.dll]") || logContents.Contains("[aspnetcorev2_outofprocess.dll]"));
|
||||
Assert.Contains("Description: IIS ASP.NET Core Module V2. Commit:", logContents);
|
||||
Assert.Contains("Description: IIS ASP.NET Core Module V2 Request Handler. Commit:", logContents);
|
||||
}
|
||||
|
|
@ -21,15 +21,11 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
{
|
||||
public CachingApplicationPublisher InProcessTestSite { get; } = new CachingApplicationPublisher(Helpers.GetInProcessTestSitesPath());
|
||||
public CachingApplicationPublisher OutOfProcessTestSite { get; } = new CachingApplicationPublisher(Helpers.GetOutOfProcessTestSitesPath());
|
||||
public CachingApplicationPublisher StartupExceptionWebsite { get; } = new CachingApplicationPublisher(Helpers.GetTestWebSitePath("StartupExceptionWebsite"));
|
||||
public CachingApplicationPublisher OverriddenServerWebSite { get; } = new CachingApplicationPublisher(Helpers.GetTestWebSitePath("OverriddenServerWebSite"));
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
InProcessTestSite.Dispose();
|
||||
OutOfProcessTestSite.Dispose();
|
||||
StartupExceptionWebsite.Dispose();
|
||||
OverriddenServerWebSite.Dispose();
|
||||
}
|
||||
|
||||
public IISDeploymentParameters GetBaseDeploymentParameters(HostingModel hostingModel = HostingModel.InProcess, bool publish = false)
|
||||
|
|
|
|||
|
|
@ -136,6 +136,13 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
return $"Configuration load error. {reason}";
|
||||
}
|
||||
|
||||
public static string OutOfProcessFailedToStart(IISDeploymentResult deploymentResult)
|
||||
{
|
||||
return $"Application '/LM/W3SVC/1/ROOT' with physical root '{EscapedContentRoot(deploymentResult)}' failed to start process with " +
|
||||
$"commandline '(.*)' with multiple retries. " +
|
||||
$"The last try of listening port is '(.*)'. See previous warnings for details.";
|
||||
}
|
||||
|
||||
private static string EscapedContentRoot(IISDeploymentResult deploymentResult)
|
||||
{
|
||||
var contentRoot = deploymentResult.ContentRoot;
|
||||
|
|
|
|||
|
|
@ -146,10 +146,18 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
public static string GetExpectedLogName(IISDeploymentResult deploymentResult, string logFolderPath)
|
||||
{
|
||||
var startTime = deploymentResult.HostProcess.StartTime.ToUniversalTime();
|
||||
return Path.Combine(logFolderPath, $"std_{startTime.Year}{startTime.Month:D2}" +
|
||||
|
||||
if (deploymentResult.DeploymentParameters.HostingModel == HostingModel.InProcess)
|
||||
{
|
||||
return Path.Combine(logFolderPath, $"std_{startTime.Year}{startTime.Month:D2}" +
|
||||
$"{startTime.Day:D2}{startTime.Hour:D2}" +
|
||||
$"{startTime.Minute:D2}{startTime.Second:D2}_" +
|
||||
$"{deploymentResult.HostProcess.Id}.log");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Directory.GetFiles(logFolderPath).Single();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,13 @@
|
|||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Server.IntegrationTesting.IIS\Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj" />
|
||||
<ProjectReference Include="..\Common.Tests\Common.Tests.csproj" />
|
||||
<ProjectReference Include="..\WebSites\**\*.csproj">
|
||||
<ProjectReference Include="..\WebSites\InProcessWebSite\InProcessWebSite.csproj">
|
||||
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\WebSites\OutOfProcessWebSite\OutOfProcessWebSite.csproj">
|
||||
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\WebSites\StressTestWebSite\StressTestWebSite.csproj">
|
||||
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ using System.Linq;
|
|||
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.IIS;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
using Newtonsoft.Json;
|
||||
|
|
@ -40,13 +39,13 @@ namespace IIS.FunctionalTests.Inprocess
|
|||
[SkipIfDebug]
|
||||
public async Task FrameworkNotFoundExceptionLogged_Pipe()
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.StartupExceptionWebsite, publish: true);
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true);
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
InvalidateRuntimeConfig(deploymentResult);
|
||||
|
||||
var response = await deploymentResult.HttpClient.GetAsync("/");
|
||||
var response = await deploymentResult.HttpClient.GetAsync("/HelloWorld");
|
||||
Assert.False(response.IsSuccessStatusCode);
|
||||
|
||||
StopServer();
|
||||
|
|
@ -60,7 +59,7 @@ namespace IIS.FunctionalTests.Inprocess
|
|||
public async Task FrameworkNotFoundExceptionLogged_File()
|
||||
{
|
||||
var deploymentParameters =
|
||||
_fixture.GetBaseDeploymentParameters(_fixture.StartupExceptionWebsite, publish: true);
|
||||
_fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true);
|
||||
|
||||
deploymentParameters.EnableLogging(_logFolderPath);
|
||||
|
||||
|
|
@ -68,7 +67,7 @@ namespace IIS.FunctionalTests.Inprocess
|
|||
|
||||
InvalidateRuntimeConfig(deploymentResult);
|
||||
|
||||
var response = await deploymentResult.HttpClient.GetAsync("/");
|
||||
var response = await deploymentResult.HttpClient.GetAsync("/HelloWorld");
|
||||
Assert.False(response.IsSuccessStatusCode);
|
||||
|
||||
StopServer();
|
||||
|
|
@ -85,14 +84,16 @@ namespace IIS.FunctionalTests.Inprocess
|
|||
public async Task EnableCoreHostTraceLogging_TwoLogFilesCreated()
|
||||
{
|
||||
var deploymentParameters =
|
||||
_fixture.GetBaseDeploymentParameters(_fixture.StartupExceptionWebsite, publish: true);
|
||||
_fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true);
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} CheckLargeStdOutWrites");
|
||||
|
||||
deploymentParameters.EnvironmentVariables["COREHOST_TRACE"] = "1";
|
||||
|
||||
deploymentParameters.EnableLogging(_logFolderPath);
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
var response = await deploymentResult.HttpClient.GetAsync("/");
|
||||
var response = await deploymentResult.HttpClient.GetAsync("/HelloWorld");
|
||||
Assert.False(response.IsSuccessStatusCode);
|
||||
|
||||
StopServer();
|
||||
|
|
@ -112,13 +113,13 @@ namespace IIS.FunctionalTests.Inprocess
|
|||
[InlineData("CheckOversizedStdOutWrites")]
|
||||
public async Task EnableCoreHostTraceLogging_PipeCaptureNativeLogs(string path)
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.StartupExceptionWebsite, publish: true);
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true);
|
||||
deploymentParameters.EnvironmentVariables["COREHOST_TRACE"] = "1";
|
||||
deploymentParameters.WebConfigBasedEnvironmentVariables["ASPNETCORE_INPROCESS_STARTUP_VALUE"] = path;
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} {path}");
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
var response = await deploymentResult.HttpClient.GetAsync("/");
|
||||
var response = await deploymentResult.HttpClient.GetAsync("/HelloWorld");
|
||||
|
||||
Assert.False(response.IsSuccessStatusCode);
|
||||
|
||||
|
|
@ -137,15 +138,15 @@ namespace IIS.FunctionalTests.Inprocess
|
|||
public async Task EnableCoreHostTraceLogging_FileCaptureNativeLogs(string path)
|
||||
{
|
||||
var deploymentParameters =
|
||||
_fixture.GetBaseDeploymentParameters(_fixture.StartupExceptionWebsite, publish: true);
|
||||
_fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true);
|
||||
deploymentParameters.EnvironmentVariables["COREHOST_TRACE"] = "1";
|
||||
deploymentParameters.WebConfigBasedEnvironmentVariables["ASPNETCORE_INPROCESS_STARTUP_VALUE"] = path;
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} {path}");
|
||||
|
||||
deploymentParameters.EnableLogging(_logFolderPath);
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
var response = await deploymentResult.HttpClient.GetAsync("/");
|
||||
var response = await deploymentResult.HttpClient.GetAsync("/HelloWorld");
|
||||
Assert.False(response.IsSuccessStatusCode);
|
||||
|
||||
StopServer();
|
||||
|
|
@ -159,7 +160,7 @@ namespace IIS.FunctionalTests.Inprocess
|
|||
|
||||
private static void InvalidateRuntimeConfig(IISDeploymentResult deploymentResult)
|
||||
{
|
||||
var path = Path.Combine(deploymentResult.ContentRoot, "StartupExceptionWebSite.runtimeconfig.json");
|
||||
var path = Path.Combine(deploymentResult.ContentRoot, "InProcessWebSite.runtimeconfig.json");
|
||||
dynamic depsFileContent = JsonConvert.DeserializeObject(File.ReadAllText(path));
|
||||
depsFileContent["runtimeOptions"]["framework"]["version"] = "2.9.9";
|
||||
var output = JsonConvert.SerializeObject(depsFileContent);
|
||||
|
|
|
|||
|
|
@ -133,9 +133,12 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task DetectsOveriddenServer()
|
||||
public async Task DetectsOverriddenServer()
|
||||
{
|
||||
var deploymentResult = await DeployAsync(_fixture.GetBaseDeploymentParameters(_fixture.OverriddenServerWebSite, publish: true));
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true);
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} OverriddenServer");
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
var response = await deploymentResult.HttpClient.GetAsync("/");
|
||||
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
|
||||
|
||||
|
|
@ -149,7 +152,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
[ConditionalFact]
|
||||
public async Task LogsStartupExceptionExitError()
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.StartupExceptionWebsite, publish: true);
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true);
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} Throw");
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
|
@ -167,9 +170,11 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
[ConditionalFact]
|
||||
public async Task LogsUnexpectedThreadExitError()
|
||||
{
|
||||
var deploymentResult = await DeployAsync(_fixture.GetBaseDeploymentParameters(_fixture.StartupExceptionWebsite, publish: true));
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true);
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} EarlyReturn");
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
var response = await deploymentResult.HttpClient.GetAsync("/");
|
||||
var response = await deploymentResult.HttpClient.GetAsync("/HelloWorld");
|
||||
Assert.Equal(HttpStatusCode.InternalServerError, response.StatusCode);
|
||||
|
||||
StopServer();
|
||||
|
|
@ -182,7 +187,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
[ConditionalFact]
|
||||
public async Task StartupTimeoutIsApplied()
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.StartupExceptionWebsite, publish: true);
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true);
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} Hang");
|
||||
deploymentParameters.WebConfigActionList.Add(
|
||||
WebConfigHelpers.AddOrModifyAspNetCoreSection("startupTimeLimit", "1"));
|
||||
|
|
@ -202,14 +207,14 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
[ConditionalFact]
|
||||
public async Task ShutdownTimeoutIsApplied()
|
||||
{
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.StartupExceptionWebsite, publish: true);
|
||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(_fixture.InProcessTestSite, publish: true);
|
||||
deploymentParameters.TransformArguments((a, _) => $"{a} HangOnStop");
|
||||
deploymentParameters.WebConfigActionList.Add(
|
||||
WebConfigHelpers.AddOrModifyAspNetCoreSection("shutdownTimeLimit", "1"));
|
||||
|
||||
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||
|
||||
Assert.Equal("OK", await deploymentResult.HttpClient.GetStringAsync("/"));
|
||||
Assert.Equal("Hello World", await deploymentResult.HttpClient.GetStringAsync("/HelloWorld"));
|
||||
|
||||
StopServer();
|
||||
|
||||
|
|
|
|||
|
|
@ -4,30 +4,12 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Hosting.Server;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace IISTestSite
|
||||
namespace TestSite
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var host = new WebHostBuilder()
|
||||
.UseIIS()
|
||||
.ConfigureServices(services => services.AddSingleton<IServer, DummyServer>())
|
||||
.Configure(builder => builder.Run(async context => { await context.Response.WriteAsync("I shouldn't work"); }))
|
||||
.Build();
|
||||
|
||||
host.Run();
|
||||
}
|
||||
}
|
||||
|
||||
public class DummyServer: IServer
|
||||
public class DummyServer : IServer
|
||||
{
|
||||
public void Dispose()
|
||||
{
|
||||
|
|
@ -2,33 +2,108 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Hosting.Server;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace IISTestSite
|
||||
namespace TestSite
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
var envVariable = Environment.GetEnvironmentVariable("ASPNETCORE_INPROCESS_INITIAL_WRITE");
|
||||
if (!string.IsNullOrEmpty(envVariable))
|
||||
var mode = args.FirstOrDefault();
|
||||
switch (mode)
|
||||
{
|
||||
Console.WriteLine(envVariable);
|
||||
Console.Error.WriteLine(envVariable);
|
||||
// Semicolons are appended to env variables; removing them.
|
||||
case "CheckLargeStdOutWrites":
|
||||
Console.WriteLine(new string('a', 30000));
|
||||
break;
|
||||
case "CheckLargeStdErrWrites":
|
||||
Console.Error.WriteLine(new string('a', 30000));
|
||||
Console.Error.Flush();
|
||||
break;
|
||||
case "ConsoleWrite":
|
||||
Console.WriteLine($"Random number: {args[1]}");
|
||||
break;
|
||||
case "ConsoleErrorWrite":
|
||||
Console.Error.WriteLine($"Random number: {args[1]}");
|
||||
Console.Error.Flush();
|
||||
break;
|
||||
case "CheckOversizedStdErrWrites":
|
||||
Console.WriteLine(new string('a', 31000));
|
||||
break;
|
||||
case "CheckOversizedStdOutWrites":
|
||||
Console.Error.WriteLine(new string('a', 31000));
|
||||
Console.Error.Flush();
|
||||
break;
|
||||
case "Hang":
|
||||
Thread.Sleep(Timeout.Infinite);
|
||||
break;
|
||||
case "Throw":
|
||||
throw new InvalidOperationException("Program.Main exception");
|
||||
case "EarlyReturn":
|
||||
return 12;
|
||||
case "HangOnStop":
|
||||
{
|
||||
var host = new WebHostBuilder()
|
||||
.UseIIS()
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
host.Run();
|
||||
|
||||
Thread.Sleep(Timeout.Infinite);
|
||||
}
|
||||
break;
|
||||
case "CheckConsoleFunctions":
|
||||
// Call a bunch of console functions and make sure none return invalid handle.
|
||||
Console.OutputEncoding = Encoding.UTF8;
|
||||
Console.Title = "Test";
|
||||
Console.WriteLine($"Is Console redirection: {Console.IsOutputRedirected}");
|
||||
Console.BackgroundColor = ConsoleColor.Blue;
|
||||
Console.WriteLine("彡⾔");
|
||||
break;
|
||||
case "OverriddenServer":
|
||||
{
|
||||
var host = new WebHostBuilder()
|
||||
.UseIIS()
|
||||
.ConfigureServices(services => services.AddSingleton<IServer, DummyServer>())
|
||||
.Configure(builder => builder.Run(async context => { await context.Response.WriteAsync("I shouldn't work"); }))
|
||||
.Build();
|
||||
host.Run();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
|
||||
var envVariable = Environment.GetEnvironmentVariable("ASPNETCORE_INPROCESS_INITIAL_WRITE");
|
||||
if (!string.IsNullOrEmpty(envVariable))
|
||||
{
|
||||
Console.WriteLine(envVariable);
|
||||
Console.Error.WriteLine(envVariable);
|
||||
}
|
||||
|
||||
var host = new WebHostBuilder()
|
||||
.ConfigureLogging((_, factory) =>
|
||||
{
|
||||
factory.AddConsole();
|
||||
factory.AddFilter("Console", level => level >= LogLevel.Information);
|
||||
})
|
||||
.UseIIS()
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
host.Run();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
var host = new WebHostBuilder()
|
||||
.ConfigureLogging((_, factory) =>
|
||||
{
|
||||
factory.AddConsole();
|
||||
factory.AddFilter("Console", level => level >= LogLevel.Information);
|
||||
})
|
||||
.UseIIS()
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
host.Run();
|
||||
return 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ using Microsoft.AspNetCore.Http.Features;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Xunit;
|
||||
|
||||
namespace IISTestSite
|
||||
namespace TestSite
|
||||
{
|
||||
public partial class Startup
|
||||
{
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -5,7 +5,7 @@ using System.IO;
|
|||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace TestSites
|
||||
namespace TestSite
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,12 +5,10 @@ using System;
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Principal;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Hosting.Server.Features;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
|
|
@ -19,9 +17,9 @@ using Microsoft.AspNetCore.Server.IISIntegration;
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Xunit;
|
||||
|
||||
namespace TestSites
|
||||
namespace TestSite
|
||||
{
|
||||
public class Startup
|
||||
public partial class Startup
|
||||
{
|
||||
private IServerAddressesFeature _serverAddresses;
|
||||
|
||||
|
|
@ -112,15 +110,6 @@ namespace TestSites
|
|||
return context.Response.WriteAsync(context.Request.Headers["ANCMRHPath"]);
|
||||
}
|
||||
|
||||
private async Task HostingEnvironment(HttpContext context)
|
||||
{
|
||||
var hostingEnv = context.RequestServices.GetService<IHostingEnvironment>();
|
||||
|
||||
await context.Response.WriteAsync("ContentRootPath "+hostingEnv.ContentRootPath + Environment.NewLine);
|
||||
await context.Response.WriteAsync("WebRootPath "+hostingEnv.WebRootPath + Environment.NewLine);
|
||||
await context.Response.WriteAsync("CurrentDirectory "+Environment.CurrentDirectory);
|
||||
}
|
||||
|
||||
private async Task ProcessId(HttpContext context)
|
||||
{
|
||||
await context.Response.WriteAsync(Process.GetCurrentProcess().Id.ToString());
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
|
||||
<InProcessTestSite>true</InProcessTestSite>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\..\..\build\testsite.props" />
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.Server.IIS\Microsoft.AspNetCore.Server.IIS.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": true,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:5762/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"ANCM IIS Express": {
|
||||
"commandName": "Executable",
|
||||
"executablePath": "$(IISExpressPath)",
|
||||
"commandLineArgs": "$(IISExpressArguments)",
|
||||
"nativeDebugging": true,
|
||||
"environmentVariables": {
|
||||
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
|
||||
"ANCM_PATH": "$(TargetDir)\\$(AncmPath)",
|
||||
"ANCMV2_PATH": "$(TargetDir)\\$(AncmV2Path)",
|
||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||
"ASPNETCORE_MODULE_DEBUG": "console"
|
||||
}
|
||||
},
|
||||
"ANCM IIS": {
|
||||
"commandName": "Executable",
|
||||
"executablePath": "$(IISPath)",
|
||||
"commandLineArgs": "$(IISArguments)",
|
||||
"environmentVariables": {
|
||||
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
|
||||
"ANCM_PATH": "$(AncmPath)",
|
||||
"ANCMV2_PATH": "$(AncmV2Path)",
|
||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||
"ASPNETCORE_MODULE_DEBUG": "console"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,79 +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.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace IISTestSite
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
var mode = args.FirstOrDefault();
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
// Semicolons are appended to env variables; removing them.
|
||||
case "CheckLargeStdOutWrites":
|
||||
Console.WriteLine(new string('a', 30000));
|
||||
break;
|
||||
case "CheckLargeStdErrWrites":
|
||||
Console.Error.WriteLine(new string('a', 30000));
|
||||
Console.Error.Flush();
|
||||
break;
|
||||
case "CheckLogFile":
|
||||
Console.WriteLine($"Random number: {args[1]}");
|
||||
break;
|
||||
case "CheckErrLogFile":
|
||||
Console.Error.WriteLine($"Random number: {args[1]}");
|
||||
Console.Error.Flush();
|
||||
break;
|
||||
case "CheckOversizedStdErrWrites":
|
||||
Console.WriteLine(new string('a', 31000));
|
||||
break;
|
||||
case "CheckOversizedStdOutWrites":
|
||||
Console.Error.WriteLine(new string('a', 31000));
|
||||
Console.Error.Flush();
|
||||
break;
|
||||
case "Hang":
|
||||
Thread.Sleep(Timeout.Infinite);
|
||||
break;
|
||||
case "Throw":
|
||||
throw new InvalidOperationException("Program.Main exception");
|
||||
case "HangOnStop":
|
||||
var host = new WebHostBuilder()
|
||||
.UseIIS()
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
host.Run();
|
||||
|
||||
Thread.Sleep(Timeout.Infinite);
|
||||
break;
|
||||
case "CheckConsoleFunctions":
|
||||
// Call a bunch of console functions and make sure none return invalid handle.
|
||||
Console.OutputEncoding = Encoding.UTF8;
|
||||
Console.Title = "Test";
|
||||
Console.WriteLine($"Is Console redirection: {Console.IsOutputRedirected}");
|
||||
Console.BackgroundColor = ConsoleColor.Blue;
|
||||
Console.WriteLine("彡⾔");
|
||||
break;
|
||||
}
|
||||
|
||||
return 12;
|
||||
}
|
||||
|
||||
public partial class Startup
|
||||
{
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
app.Run(async context => await context.Response.WriteAsync("OK"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": true,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:5762/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"ANCM IIS Express": {
|
||||
"commandName": "Executable",
|
||||
"executablePath": "$(IISExpressPath)",
|
||||
"commandLineArgs": "$(IISExpressArguments)",
|
||||
"nativeDebugging": true,
|
||||
"environmentVariables": {
|
||||
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
|
||||
"ANCM_PATH": "$(TargetDir)\\$(AncmPath)",
|
||||
"ANCMV2_PATH": "$(TargetDir)\\$(AncmV2Path)",
|
||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||
"ASPNETCORE_MODULE_DEBUG": "console"
|
||||
}
|
||||
},
|
||||
"ANCM IIS": {
|
||||
"commandName": "Executable",
|
||||
"executablePath": "$(IISPath)",
|
||||
"commandLineArgs": "$(IISArguments)",
|
||||
"environmentVariables": {
|
||||
"IIS_SITE_PATH": "$(MSBuildThisFileDirectory)",
|
||||
"ANCM_PATH": "$(AncmPath)",
|
||||
"ANCMV2_PATH": "$(AncmV2Path)",
|
||||
"LAUNCHER_ARGS": "$(TargetPath)",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"LAUNCHER_PATH": "$(DotNetPath)",
|
||||
"ASPNETCORE_MODULE_DEBUG": "console"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.2</TargetFrameworks>
|
||||
<InProcessTestSite>true</InProcessTestSite>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="..\..\..\build\testsite.props" />
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.Server.IIS\Microsoft.AspNetCore.Server.IIS.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" hostingModel="inprocess">
|
||||
</aspNetCore>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
// 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.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace TestSite
|
||||
{
|
||||
public partial class Startup
|
||||
{
|
||||
private async Task HostingEnvironment(HttpContext ctx)
|
||||
{
|
||||
var hostingEnv = ctx.RequestServices.GetService<IHostingEnvironment>();
|
||||
|
||||
await ctx.Response.WriteAsync("ContentRootPath " + hostingEnv.ContentRootPath + Environment.NewLine);
|
||||
await ctx.Response.WriteAsync("WebRootPath " + hostingEnv.WebRootPath + Environment.NewLine);
|
||||
await ctx.Response.WriteAsync("CurrentDirectory " + Environment.CurrentDirectory);
|
||||
}
|
||||
|
||||
private async Task ConsoleWrite(HttpContext ctx)
|
||||
{
|
||||
Console.WriteLine("TEST MESSAGE");
|
||||
|
||||
await ctx.Response.WriteAsync("Hello World");
|
||||
}
|
||||
|
||||
private async Task ConsoleErrorWrite(HttpContext ctx)
|
||||
{
|
||||
Console.Error.WriteLine("TEST MESSAGE");
|
||||
|
||||
await ctx.Response.WriteAsync("Hello World");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue