Creates two separate projects for ANCM V1 and V2.

This commit is contained in:
Pavel Krymets 2018-04-10 13:54:46 -07:00 committed by Justin Kotalik
commit 157e7f4fdd
168 changed files with 16100 additions and 506 deletions

View File

@ -60,14 +60,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InProcessWebSite", "test\We
{439824F9-1455-4CC4-BD79-B44FA0A16552} = {439824F9-1455-4CC4-BD79-B44FA0A16552}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AspNetCore", "src\AspNetCore\AspNetCore.vcxproj", "{439824F9-1455-4CC4-BD79-B44FA0A16552}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IISLib", "src\IISLib\IISLib.vcxproj", "{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonLib", "src\CommonLib\CommonLib.vcxproj", "{55494E58-E061-4C4C-A0A8-837008E72F85}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RequestHandler", "src\RequestHandler\RequestHandler.vcxproj", "{D57EA297-6DC2-4BC0-8C91-334863327863}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IIS", "src\Microsoft.AspNetCore.Server.IIS\Microsoft.AspNetCore.Server.IIS.csproj", "{46A8612B-418B-4D70-B3A7-A21DD0627473}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StressTestWebSite", "test\WebSites\StressTestWebSite\StressTestWebSite.csproj", "{13FD8F12-FFBE-4D01-B4AC-444F2994B04F}"
@ -86,6 +78,22 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonLibTests", "test\Comm
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtest", "test\gtest-1.8.0\msvc\gtest.vcxproj", "{2AF210A9-5BDC-45E8-95DD-07B5A2616493}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AspNetCoreModuleV1", "AspNetCoreModuleV1", "{16E521CE-77F1-4B1C-A183-520A41C4F372}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AspNetCoreModuleV2", "AspNetCoreModuleV2", "{06CA2C2B-83B0-4D83-905A-E0C74790009E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IISLib", "src\AspNetCoreModuleV1\IISLib\IISLib.vcxproj", "{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AspNetCore", "src\AspNetCoreModuleV1\AspNetCore\AspNetCore.vcxproj", "{439824F9-1455-4CC4-BD79-B44FA0A16552}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AspNetCore", "src\AspNetCoreModuleV2\AspNetCore\AspNetCore.vcxproj", "{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonLib", "src\AspNetCoreModuleV2\CommonLib\CommonLib.vcxproj", "{55494E58-E061-4C4C-A0A8-837008E72F85}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IISLib", "src\AspNetCoreModuleV2\IISLib\IISLib.vcxproj", "{09D9D1D6-2951-4E14-BC35-76A23CF9391A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RequestHandler", "src\AspNetCoreModuleV2\RequestHandler\RequestHandler.vcxproj", "{D57EA297-6DC2-4BC0-8C91-334863327863}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -176,46 +184,6 @@ Global
{679FA2A2-898B-4320-884E-C2D294A97CE1}.Release|x64.Build.0 = Release|x64
{679FA2A2-898B-4320-884E-C2D294A97CE1}.Release|x86.ActiveCfg = Release|x86
{679FA2A2-898B-4320-884E-C2D294A97CE1}.Release|x86.Build.0 = Release|x86
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|Any CPU.ActiveCfg = Debug|x64
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x64.ActiveCfg = Debug|x64
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x64.Build.0 = Debug|x64
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x86.ActiveCfg = Debug|Win32
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x86.Build.0 = Debug|Win32
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|Any CPU.ActiveCfg = Release|x64
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x64.ActiveCfg = Release|x64
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x64.Build.0 = Release|x64
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x86.ActiveCfg = Release|Win32
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x86.Build.0 = Release|Win32
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|Any CPU.ActiveCfg = Debug|x64
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x64.ActiveCfg = Debug|x64
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x64.Build.0 = Debug|x64
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x86.ActiveCfg = Debug|Win32
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x86.Build.0 = Debug|Win32
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|Any CPU.ActiveCfg = Release|x64
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x64.ActiveCfg = Release|x64
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x64.Build.0 = Release|x64
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x86.ActiveCfg = Release|Win32
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x86.Build.0 = Release|Win32
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|Any CPU.ActiveCfg = Debug|x64
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x64.ActiveCfg = Debug|x64
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x64.Build.0 = Debug|x64
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x86.ActiveCfg = Debug|Win32
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x86.Build.0 = Debug|Win32
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|Any CPU.ActiveCfg = Release|x64
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x64.ActiveCfg = Release|x64
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x64.Build.0 = Release|x64
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x86.ActiveCfg = Release|Win32
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x86.Build.0 = Release|Win32
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|Any CPU.ActiveCfg = Debug|Win32
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x64.ActiveCfg = Debug|x64
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x64.Build.0 = Debug|x64
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x86.ActiveCfg = Debug|Win32
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x86.Build.0 = Debug|Win32
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|Any CPU.ActiveCfg = Release|Win32
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x64.ActiveCfg = Release|x64
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x64.Build.0 = Release|x64
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x86.ActiveCfg = Release|Win32
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x86.Build.0 = Release|Win32
{46A8612B-418B-4D70-B3A7-A21DD0627473}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{46A8612B-418B-4D70-B3A7-A21DD0627473}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46A8612B-418B-4D70-B3A7-A21DD0627473}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -260,6 +228,66 @@ Global
{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
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|Any CPU.ActiveCfg = Debug|Win32
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x64.ActiveCfg = Debug|x64
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x64.Build.0 = Debug|x64
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x86.ActiveCfg = Debug|Win32
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Debug|x86.Build.0 = Debug|Win32
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|Any CPU.ActiveCfg = Release|Win32
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x64.ActiveCfg = Release|x64
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x64.Build.0 = Release|x64
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x86.ActiveCfg = Release|Win32
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE}.Release|x86.Build.0 = Release|Win32
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|Any CPU.ActiveCfg = Debug|Win32
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x64.ActiveCfg = Debug|x64
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x64.Build.0 = Debug|x64
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x86.ActiveCfg = Debug|Win32
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Debug|x86.Build.0 = Debug|Win32
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|Any CPU.ActiveCfg = Release|Win32
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x64.ActiveCfg = Release|x64
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x64.Build.0 = Release|x64
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x86.ActiveCfg = Release|Win32
{439824F9-1455-4CC4-BD79-B44FA0A16552}.Release|x86.Build.0 = Release|Win32
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Debug|Any CPU.ActiveCfg = Debug|Win32
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Debug|x64.ActiveCfg = Debug|x64
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Debug|x64.Build.0 = Debug|x64
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Debug|x86.ActiveCfg = Debug|Win32
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Debug|x86.Build.0 = Debug|Win32
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Release|Any CPU.ActiveCfg = Release|Win32
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Release|x64.ActiveCfg = Release|x64
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Release|x64.Build.0 = Release|x64
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Release|x86.ActiveCfg = Release|Win32
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}.Release|x86.Build.0 = Release|Win32
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|Any CPU.ActiveCfg = Debug|Win32
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x64.ActiveCfg = Debug|x64
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x64.Build.0 = Debug|x64
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x86.ActiveCfg = Debug|Win32
{55494E58-E061-4C4C-A0A8-837008E72F85}.Debug|x86.Build.0 = Debug|Win32
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|Any CPU.ActiveCfg = Release|Win32
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x64.ActiveCfg = Release|x64
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x64.Build.0 = Release|x64
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x86.ActiveCfg = Release|Win32
{55494E58-E061-4C4C-A0A8-837008E72F85}.Release|x86.Build.0 = Release|Win32
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Debug|Any CPU.ActiveCfg = Debug|Win32
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Debug|x64.ActiveCfg = Debug|x64
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Debug|x64.Build.0 = Debug|x64
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Debug|x86.ActiveCfg = Debug|Win32
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Debug|x86.Build.0 = Debug|Win32
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Release|Any CPU.ActiveCfg = Release|Win32
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Release|x64.ActiveCfg = Release|x64
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Release|x64.Build.0 = Release|x64
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Release|x86.ActiveCfg = Release|Win32
{09D9D1D6-2951-4E14-BC35-76A23CF9391A}.Release|x86.Build.0 = Release|Win32
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|Any CPU.ActiveCfg = Debug|Win32
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x64.ActiveCfg = Debug|x64
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x64.Build.0 = Debug|x64
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x86.ActiveCfg = Debug|Win32
{D57EA297-6DC2-4BC0-8C91-334863327863}.Debug|x86.Build.0 = Debug|Win32
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|Any CPU.ActiveCfg = Release|Win32
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x64.ActiveCfg = Release|x64
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x64.Build.0 = Release|x64
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x86.ActiveCfg = Release|Win32
{D57EA297-6DC2-4BC0-8C91-334863327863}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -272,15 +300,19 @@ Global
{4E3E1F5C-CD52-4CC0-A35F-D1FA1685D2FA} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
{9BC4AFCB-325D-4C81-8228-8CF301CE2F97} = {C74B8F36-FD2F-45C9-9B8A-00E7CF0126A9}
{679FA2A2-898B-4320-884E-C2D294A97CE1} = {744ACDC6-F6A0-4FF9-9421-F25C5F2DC520}
{439824F9-1455-4CC4-BD79-B44FA0A16552} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
{55494E58-E061-4C4C-A0A8-837008E72F85} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
{D57EA297-6DC2-4BC0-8C91-334863327863} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
{46A8612B-418B-4D70-B3A7-A21DD0627473} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
{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}
{16E521CE-77F1-4B1C-A183-520A41C4F372} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
{06CA2C2B-83B0-4D83-905A-E0C74790009E} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
{4787A64F-9A3E-4867-A55A-70CB4B2B2FFE} = {16E521CE-77F1-4B1C-A183-520A41C4F372}
{439824F9-1455-4CC4-BD79-B44FA0A16552} = {16E521CE-77F1-4B1C-A183-520A41C4F372}
{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B} = {06CA2C2B-83B0-4D83-905A-E0C74790009E}
{55494E58-E061-4C4C-A0A8-837008E72F85} = {06CA2C2B-83B0-4D83-905A-E0C74790009E}
{09D9D1D6-2951-4E14-BC35-76A23CF9391A} = {06CA2C2B-83B0-4D83-905A-E0C74790009E}
{D57EA297-6DC2-4BC0-8C91-334863327863} = {06CA2C2B-83B0-4D83-905A-E0C74790009E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DB4F868D-E1AE-4FD7-9333-69FA15B268C5}

View File

@ -2,8 +2,9 @@
<Project ToolsVersion="12.0" DefaultTargets="Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)\Build.Settings" />
<ItemGroup>
<Projects Include="$(SolutionDir)\src\AspNetCore\AspNetCore.vcxproj" />
<Projects Include="$(SolutionDir)\src\RequestHandler\RequestHandler.vcxproj" />
<Projects Include="$(SolutionDir)\src\AspNetCoreModuleV1\AspNetCore\AspNetCore.vcxproj" />
<Projects Include="$(SolutionDir)\src\AspNetCoreModuleV2\AspNetCore\AspNetCore.vcxproj" />
<Projects Include="$(SolutionDir)\src\AspNetCoreModuleV2\RequestHandler\RequestHandler.vcxproj" />
<Projects Include="$(SolutionDir)\test\CommonLibTests\CommonLibTests.vcxproj">
</ItemGroup>

View File

@ -20,9 +20,11 @@
Text="Could not find an installation of Visual Studio with the C++ development tools."
Condition="'$(VisualStudioMSBuildx86Path)' == ''" />
<Exec Command="&quot;$(VisualStudioMSBuildx86Path)&quot; &quot;$(RepositoryRoot)src\AspNetCore\AspNetCore.vcxproj&quot; $(BuildArgs) -p:Platform=%(Platforms.Identity) -bl:$(LogOutputDir)native.%(Platforms.Identity).binlog"
<Exec Command="&quot;$(VisualStudioMSBuildx86Path)&quot; &quot;$(RepositoryRoot)src\AspNetCoreModuleV1\AspNetCore\AspNetCore.vcxproj&quot; $(BuildArgs) -p:Platform=%(Platforms.Identity) -bl:$(LogOutputDir)native.%(Platforms.Identity).binlog"
Condition="'$(VisualStudioMSBuildx86Path)' != ''" />
<Exec Command="&quot;$(VisualStudioMSBuildx86Path)&quot; &quot;$(RepositoryRoot)src\RequestHandler\RequestHandler.vcxproj&quot; $(BuildArgs) -p:Platform=%(Platforms.Identity) -bl:$(LogOutputDir)native.%(Platforms.Identity).binlog"
<Exec Command="&quot;$(VisualStudioMSBuildx86Path)&quot; &quot;$(RepositoryRoot)src\AspNetCoreModuleV2\AspNetCore\AspNetCore.vcxproj&quot; $(BuildArgs) -p:Platform=%(Platforms.Identity) -bl:$(LogOutputDir)native.%(Platforms.Identity).binlog"
Condition="'$(VisualStudioMSBuildx86Path)' != ''" />
<Exec Command="&quot;$(VisualStudioMSBuildx86Path)&quot; &quot;$(RepositoryRoot)src\AspNetCoreModuleV2\RequestHandler\RequestHandler.vcxproj&quot; $(BuildArgs) -p:Platform=%(Platforms.Identity) -bl:$(LogOutputDir)native.%(Platforms.Identity).binlog"
Condition="'$(VisualStudioMSBuildx86Path)' != ''" />
<Exec Command="&quot;$(VisualStudioMSBuildx86Path)&quot; &quot;$(RepositoryRoot)test\CommonLibTests\CommonLibTests.vcxproj&quot; $(BuildArgs) -p:Platform=%(Platforms.Identity) -bl:$(LogOutputDir)native.%(Platforms.Identity).binlog"
Condition="'$(VisualStudioMSBuildx86Path)' != ''" />
@ -46,6 +48,8 @@
<FilesToSign Include="$(AncmZipOutputPath)" IsContainer="true" />
<FilesToSign Include="x64/aspnetcore.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
<FilesToSign Include="x86/aspnetcore.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
<FilesToSign Include="x64/aspnetcoreV2.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
<FilesToSign Include="x86/aspnetcoreV2.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
<FilesToSign Include="x64/aspnetcorerh.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
<FilesToSign Include="x86/aspnetcorerh.dll" Container="$(AncmZipOutputPath)" Certificate="$(AssemblySigningCertName)" />
</ItemGroup>
@ -59,18 +63,22 @@
<ItemGroup>
<!-- x64 -->
<AncmFiles Include="$(RepositoryRoot)src\AspNetCore\bin\$(Configuration)\x64\aspnetcore.dll" Link="x64\aspnetcore.dll" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCore\bin\$(Configuration)\x64\aspnetcore.pdb" Link="x64\aspnetcore.pdb" />
<AncmFiles Include="$(RepositoryRoot)src\RequestHandler\bin\$(Configuration)\x64\aspnetcorerh.dll" Link="x64\aspnetcorerh.dll" />
<AncmFiles Include="$(RepositoryRoot)src\RequestHandler\bin\$(Configuration)\x64\aspnetcorerh.pdb" Link="x64\aspnetcorerh.pdb" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV1\AspNetCore\bin\$(Configuration)\x64\aspnetcore.dll" Link="x64\aspnetcore.dll" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV1\AspNetCore\bin\$(Configuration)\x64\aspnetcore.pdb" Link="x64\aspnetcore.pdb" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\x64\aspnetcoreV2.dll" Link="x64\aspnetcoreV2.dll" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\x64\aspnetcoreV2.pdb" Link="x64\aspnetcoreV2.pdb" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\RequestHandler\bin\$(Configuration)\x64\aspnetcorerh.dll" Link="x64\aspnetcorerh.dll" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\RequestHandler\bin\$(Configuration)\x64\aspnetcorerh.pdb" Link="x64\aspnetcorerh.pdb" />
<!-- x86 -->
<AncmFiles Include="$(RepositoryRoot)src\AspNetCore\bin\$(Configuration)\Win32\aspnetcore.dll" Link="x86\aspnetcore.dll" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCore\bin\$(Configuration)\Win32\aspnetcore.pdb" Link="x86\aspnetcore.pdb" />
<AncmFiles Include="$(RepositoryRoot)src\RequestHandler\bin\$(Configuration)\Win32\aspnetcorerh.dll" Link="x86\aspnetcorerh.dll" />
<AncmFiles Include="$(RepositoryRoot)src\RequestHandler\bin\$(Configuration)\Win32\aspnetcorerh.pdb" Link="x86\aspnetcorerh.pdb" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV1\AspNetCore\bin\$(Configuration)\Win32\aspnetcore.dll" Link="x86\aspnetcore.dll" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV1\AspNetCore\bin\$(Configuration)\Win32\aspnetcore.pdb" Link="x86\aspnetcore.pdb" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\Win32\aspnetcoreV2.dll" Link="x86\aspnetcoreV2.dll" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\Win32\aspnetcoreV2.pdb" Link="x86\aspnetcoreV2.pdb" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\RequestHandler\bin\$(Configuration)\Win32\aspnetcorerh.dll" Link="x86\aspnetcorerh.dll" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\RequestHandler\bin\$(Configuration)\Win32\aspnetcorerh.pdb" Link="x86\aspnetcorerh.pdb" />
<!-- Schema-->
<AncmFiles Include="$(RepositoryRoot)src\AspNetCore\bin\$(Configuration)\x64\aspnetcore_schema.xml" Link="aspnetcore_schema.xml" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCore\bin\$(Configuration)\x64\ancm.mof" Link="ancm.mof" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\x64\aspnetcore_schema.xml" Link="aspnetcore_schema.xml" />
<AncmFiles Include="$(RepositoryRoot)src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\x64\ancm.mof" Link="ancm.mof" />
</ItemGroup>
<ZipArchive File="$(AncmZipOutputPath)"

View File

@ -28,17 +28,17 @@
<BasePathForRequestHandler Condition="'$(RuntimeIdentifier)' == ''">$(NativePlatform)\</BasePathForRequestHandler>
</PropertyGroup>
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
<None Include="$(MSBuildThisFileDirectory)..\src\RequestHandler\bin\$(Configuration)\$(NativeFolder)\aspnetcorerh.dll" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(BasePathForRequestHandler)%(FileName)%(Extension)" />
<None Include="$(MSBuildThisFileDirectory)..\src\RequestHandler\bin\$(Configuration)\$(NativeFolder)\aspnetcorerh.pdb" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(BasePathForRequestHandler)%(FileName)%(Extension)" />
<None Include="$(MSBuildThisFileDirectory)..\src\AspNetCore\bin\$(Configuration)\$(NativeFolder)\aspnetcore.dll" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(NativePlatform)\%(FileName)%(Extension)" />
<None Include="$(MSBuildThisFileDirectory)..\src\AspNetCore\bin\$(Configuration)\$(NativeFolder)\aspnetcore.pdb" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(NativePlatform)\%(FileName)%(Extension)" />
<None Include="$(MSBuildThisFileDirectory)..\src\AspNetCoreModuleV2\RequestHandler\bin\$(Configuration)\$(NativeFolder)\aspnetcorerh.dll" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(BasePathForRequestHandler)%(FileName)%(Extension)" />
<None Include="$(MSBuildThisFileDirectory)..\src\AspNetCoreModuleV2\RequestHandler\bin\$(Configuration)\$(NativeFolder)\aspnetcorerh.pdb" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(BasePathForRequestHandler)%(FileName)%(Extension)" />
<None Include="$(MSBuildThisFileDirectory)..\src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\$(NativeFolder)\aspnetcoreV2.dll" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(NativePlatform)\%(FileName)%(Extension)" />
<None Include="$(MSBuildThisFileDirectory)..\src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\$(NativeFolder)\aspnetcoreV2.pdb" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="$(NativePlatform)\%(FileName)%(Extension)" />
</ItemGroup>
<PropertyGroup>
<IISExpressArguments>/config:"$(IISExpressAppHostConfig)"</IISExpressArguments>
<IISArguments>-h "$(IISAppHostConfig)"</IISArguments>
<AncmPath>$(NativePlatform)\aspnetcore.dll</AncmPath>
<AncmPath>$(NativePlatform)\aspnetcoreV2.dll</AncmPath>
<AncmRHPath>$(NativePlatform)\aspnetcorerh.dll</AncmRHPath>
<DotNetPath>$(userprofile)\.dotnet\$(NativePlatform)\dotnet.exe</DotNetPath>
</PropertyGroup>

View File

@ -19,11 +19,13 @@
</contentFiles>
</metadata>
<files>
<file src="src\AspNetCore\bin\$Configuration$\Win32\aspnetcore.dll" target="contentFiles\any\any\x86\aspnetcore.dll" />
<file src="src\AspNetCore\bin\$Configuration$\x64\aspnetcore.dll" target="contentFiles\any\any\x64\aspnetcore.dll" />
<file src="src\RequestHandler\bin\$Configuration$\Win32\aspnetcorerh.dll" target="contentFiles\any\any\x86\aspnetcorerh.dll" />
<file src="src\RequestHandler\bin\$Configuration$\x64\aspnetcorerh.dll" target="contentFiles\any\any\x64\aspnetcorerh.dll" />
<file src="src\AspNetCore\bin\$Configuration$\x64\*.xml"/>
<file src="src\AspNetCoreModuleV1\AspNetCore\bin\$Configuration$\Win32\aspnetcore.dll" target="contentFiles\any\any\x86\aspnetcore.dll" />
<file src="src\AspNetCoreModuleV1\AspNetCore\bin\$Configuration$\x64\aspnetcore.dll" target="contentFiles\any\any\x64\aspnetcore.dll" />
<file src="src\AspNetCoreModuleV2\AspNetCore\bin\$Configuration$\Win32\aspnetcoreV2.dll" target="contentFiles\any\any\x86\aspnetcoreV2.dll" />
<file src="src\AspNetCoreModuleV2\AspNetCore\bin\$Configuration$\x64\aspnetcoreV2.dll" target="contentFiles\any\any\x64\aspnetcoreV2.dll" />
<file src="src\AspNetCoreModuleV2\RequestHandler\bin\$Configuration$\Win32\aspnetcorerh.dll" target="contentFiles\any\any\x86\aspnetcorerh.dll" />
<file src="src\AspNetCoreModuleV2\RequestHandler\bin\$Configuration$\x64\aspnetcorerh.dll" target="contentFiles\any\any\x64\aspnetcorerh.dll" />
<file src="src\AspNetCoreModuleV2\AspNetCore\bin\$Configuration$\x64\*.xml"/>
<file src="tools\installancm.ps1"/>
<file src="LICENSE.txt"/>
<file src="nuget\Microsoft.AspNetCore.AspNetCoreModule.props" target="build\" />

View File

@ -0,0 +1,238 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\Build\Build.Settings" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{439824F9-1455-4CC4-BD79-B44FA0A16552}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>AspNetCoreModule</RootNamespace>
<ProjectName>AspNetCore</ProjectName>
<TargetName>aspnetcore</TargetName>
<LinkIncremental>false</LinkIncremental>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<OutDir>$(MSBuildProjectDirectory)\bin\$(Configuration)\$(Platform)\</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>..\IISLib;.\Inc</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<TreatWarningAsError>true</TreatWarningAsError>
<SDLCheck>true</SDLCheck>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PreprocessKeepComments>false</PreprocessKeepComments>
<ExceptionHandling>SyncCThrow</ExceptionHandling>
<StructMemberAlignment>8Bytes</StructMemberAlignment>
<FunctionLevelLinking>true</FunctionLevelLinking>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<OmitDefaultLibName>true</OmitDefaultLibName>
<CompileAs>CompileAsCpp</CompileAs>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ahadmin.lib;rpcrt4.lib;winhttp.lib;pdh.lib;ws2_32.lib;wbemuuid.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName).pch</PrecompiledHeaderOutputFile>
<AdditionalIncludeDirectories>..\IISLib;.\Inc</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<TreatWarningAsError>true</TreatWarningAsError>
<SDLCheck>true</SDLCheck>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PreprocessKeepComments>false</PreprocessKeepComments>
<ExceptionHandling>SyncCThrow</ExceptionHandling>
<StructMemberAlignment>8Bytes</StructMemberAlignment>
<FunctionLevelLinking>true</FunctionLevelLinking>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<OmitDefaultLibName>true</OmitDefaultLibName>
<CompileAs>CompileAsCpp</CompileAs>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;user32.lib;advapi32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;ahadmin.lib;rpcrt4.lib;winhttp.lib;pdh.lib;ws2_32.lib;wbemuuid.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\IISLib;inc</AdditionalIncludeDirectories>
<PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<TreatWarningAsError>true</TreatWarningAsError>
<SDLCheck>true</SDLCheck>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PreprocessKeepComments>false</PreprocessKeepComments>
<ExceptionHandling>SyncCThrow</ExceptionHandling>
<StructMemberAlignment>8Bytes</StructMemberAlignment>
<FunctionLevelLinking>true</FunctionLevelLinking>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<OmitDefaultLibName>true</OmitDefaultLibName>
<CompileAs>CompileAsCpp</CompileAs>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;winhttp.lib;odbc32.lib;ws2_32.lib;odbccp32.lib;wbemuuid.lib;iphlpapi.lib;pdh.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;ASPNETCOREMODULE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeaderFile>precomp.hxx</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>..\IISLib;inc</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<TreatWarningAsError>true</TreatWarningAsError>
<SDLCheck>true</SDLCheck>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PreprocessKeepComments>false</PreprocessKeepComments>
<ExceptionHandling>SyncCThrow</ExceptionHandling>
<StructMemberAlignment>8Bytes</StructMemberAlignment>
<FunctionLevelLinking>true</FunctionLevelLinking>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
<OmitDefaultLibName>true</OmitDefaultLibName>
<CompileAs>CompileAsCpp</CompileAs>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;ahadmin.lib;rpcrt4.lib;winhttp.lib;pdh.lib;ws2_32.lib;wbemuuid.lib;iphlpapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\Commonlib</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="..\IISLib\IISLib.vcxproj">
<Project>{4787a64f-9a3e-4867-a55a-70cb4b2b2ffe}</Project>
<LinkLibraryDependencies>false</LinkLibraryDependencies>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="ancm.mof" />
<None Include="Source.def" />
</ItemGroup>
<ItemGroup>
<Content Include="aspnetcore_schema.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="ancm.mof">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Xml Include="aspnetcore_schema.xml" />
</ItemGroup>
<Import Project="..\..\..\build\native.targets" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

Binary file not shown.

Binary file not shown.

View File

@ -1,120 +1,120 @@
// Microsoft Visual C++ generated resource script.
//
#include <windows.h>
#include "version.h"
#include "..\CommonLib\Aspnetcore_msg.rc"
#include "..\CommonLib\resources.h"
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#define FileDescription "IIS AspNetCore Module. Commit: " CommitHash
/////////////////////////////////////////////////////////////////////////////
//
// 11
//
//1 11
//BEGIN
// 0x0001, 0x0000, 0x03e8, 0x0000, 0x03ed, 0x0000, 0x0010, 0x0000, 0x0010,
// 0x0001, 0x0025, 0x0031, 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001,
// 0x0025, 0x0031, 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025,
// 0x0031, 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, 0x0031,
// 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, 0x0031, 0x000d,
// 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, 0x0031, 0x000d, 0x000a,
// 0x0000, 0x0000
//END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"..\CommonLib\resources.h\0"
END
2 TEXTINCLUDE
BEGIN
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION FileVersion
PRODUCTVERSION ProductVersion
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Microsoft Corporation"
VALUE "FileDescription", FileDescription
VALUE "FileVersion", FileVersionStr
VALUE "InternalName", "aspnetcore"
VALUE "LegalCopyright", "Copyright (C) Microsoft Corporation"
VALUE "OriginalFilename", "aspnetcore.dll"
VALUE "ProductName", "ASP.NET Core Module"
VALUE "ProductVersion", ProductVersionStr
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_INVALID_PROPERTY "Property name '%s' in system.webServer/aspNetCore section has invalid value '%s' which does not conform to the prescribed format"
IDS_SERVER_ERROR "There was a connection error while trying to route the request."
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
// Microsoft Visual C++ generated resource script.
//
#include <windows.h>
#include "version.h"
#include "..\CommonLib\Aspnetcore_msg.rc"
#include "..\CommonLib\resources.h"
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#define FileDescription "IIS AspNetCore Module. Commit: " CommitHash
/////////////////////////////////////////////////////////////////////////////
//
// 11
//
//1 11
//BEGIN
// 0x0001, 0x0000, 0x03e8, 0x0000, 0x03ed, 0x0000, 0x0010, 0x0000, 0x0010,
// 0x0001, 0x0025, 0x0031, 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001,
// 0x0025, 0x0031, 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025,
// 0x0031, 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, 0x0031,
// 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, 0x0031, 0x000d,
// 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, 0x0031, 0x000d, 0x000a,
// 0x0000, 0x0000
//END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"..\CommonLib\resources.h\0"
END
2 TEXTINCLUDE
BEGIN
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION FileVersion
PRODUCTVERSION ProductVersion
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Microsoft Corporation"
VALUE "FileDescription", FileDescription
VALUE "FileVersion", FileVersionStr
VALUE "InternalName", "aspnetcore"
VALUE "LegalCopyright", "Copyright (C) Microsoft Corporation"
VALUE "OriginalFilename", "aspnetcore.dll"
VALUE "ProductName", "ASP.NET Core Module"
VALUE "ProductVersion", ProductVersionStr
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_INVALID_PROPERTY "Property name '%s' in system.webServer/aspNetCore section has invalid value '%s' which does not conform to the prescribed format"
IDS_SERVER_ERROR "There was a connection error while trying to route the request."
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
// This file is auto-generated
#define FileVersion 8,1,18099,0
#define FileVersionStr "8.1.18099.0\0"
#define ProductVersion 8,1,18099,0
#define ProductVersionStr "8.1.18099.0\0"
#define PlatformToolset "v141\0"
#define CommitHash "e07bcc3f9b123ef8dbde6a0328ef4c9f07ed73b0\0"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\Build\Build.Settings" />
<Import Project="..\..\..\Build\Build.Settings" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
@ -20,11 +20,11 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{439824F9-1455-4CC4-BD79-B44FA0A16552}</ProjectGuid>
<ProjectGuid>{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>AspNetCoreModule</RootNamespace>
<ProjectName>AspNetCore</ProjectName>
<TargetName>aspnetcore</TargetName>
<TargetName>aspnetcoreV2</TargetName>
<LinkIncremental>false</LinkIncremental>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
</PropertyGroup>
@ -254,7 +254,7 @@
<ItemGroup>
<Xml Include="aspnetcore_schema.xml" />
</ItemGroup>
<Import Project="..\..\build\native.targets" />
<Import Project="..\..\..\build\native.targets" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -0,0 +1,4 @@
LIBRARY aspnetcore
EXPORTS
RegisterModule

View File

@ -0,0 +1,208 @@
#pragma classflags("forceupdate")
#pragma namespace ("\\\\.\\Root\\WMI")
#pragma autorecover
/*
* AspNetCore module trace events layout
* Uncomment the following class to run mof2trace to generate header file
* comment it back before checking it in */
[Dynamic,
Description("IIS: WWW Server"),
Guid("{3a2a4e84-4c21-4981-ae10-3fda0d9b0f83}"),
locale("MS\\0x409")]
class IIS_Trace:EventTrace
{
[Description ("Enable Flags") : amended,
ValueDescriptions{
"AspNetCore module events" } : amended,
DefineValues{
"ETW_IIS_ANCM" },
Values{
"ANCM" },
ValueMap{
"0x10000" }
]
uint32 Flags;
[Description ("Levels") : amended,
ValueDescriptions{
"Abnormal exit or termination",
"Severe errors",
"Warnings",
"Information",
"Detailed information" } : amended,
DefineValues{
"TRACE_LEVEL_FATAL",
"TRACE_LEVEL_ERROR",
"TRACE_LEVEL_WARNING",
"TRACE_LEVEL_INFORMATION",
"TRACE_LEVEL_VERBOSE" },
Values{
"Fatal",
"Error",
"Warning",
"Information",
"Verbose" },
ValueMap{
"0x1",
"0x2",
"0x3",
"0x4",
"0x5" },
ValueType("index")
]
uint32 Level;
};
*/
[Dynamic,
Description("ANCM runtime events") : amended,
Guid("{82ADEAD7-12B2-4781-BDCA-5A4B6C757191}"),
EventVersion(1),
DisplayName("ANCM"),
EventANCMRuntime,
locale("MS\\0x409")
]
class ANCM_Events:IIS_Trace
{
};
[Dynamic,
Description("Start application success") : amended,
EventType(1),
EventLevel(4),
EventTypeName("ANCM_START_APPLICATION_SUCCESS") : amended
]
class ANCMAppStart:ANCM_Events
{
[WmiDataId(1),
Description("Context ID") : amended,
extension("Guid"),
ActivityID,
read]
object ContextId;
[WmiDataId(2),
Description("Application Description") : amended,
StringTermination("NullTerminated"),
format("w"),
read]
string AppDescription;
};
[Dynamic,
Description("Start application failed") : amended,
EventType(2),
EventLevel(2),
EventTypeName("ANCM_START_APPLICATION_FAIL") : amended
]
class ANCMAppStartFail:ANCM_Events
{
[WmiDataId(1),
Description("Context ID") : amended,
extension("Guid"),
ActivityID,
read]
object ContextId;
[WmiDataId(2),
Description("Application Start Failure Description") : amended,
StringTermination("NullTerminated"),
format("w"),
read]
string FailureDescription;
};
[Dynamic,
Description("Start forwarding request") : amended,
EventType(3),
EventLevel(4),
EventTypeName("ANCM_REQUEST_FORWARD_START") : amended
]
class ANCMForwardStart:ANCM_Events
{
[WmiDataId(1),
Description("Context ID") : amended,
extension("Guid"),
ActivityID,
read]
object ContextId;
};
[Dynamic,
Description("Finish forwarding request") : amended,
EventType(4),
EventLevel(4),
EventTypeName("ANCM_REQUEST_FORWARD_END") : amended
]
class ANCMForwardEnd:ANCM_Events
{
[WmiDataId(1),
Description("Context ID") : amended,
extension("Guid"),
ActivityID,
read]
object ContextId;
};
[Dynamic,
Description("Forwarding request failure") : amended,
EventType(5),
EventLevel(2),
EventTypeName("ANCM_REQUEST_FORWARD_FAIL") : amended
]
class ANCMForwardFail:ANCM_Events
{
[WmiDataId(1),
Description("Context ID") : amended,
extension("Guid"),
ActivityID,
read]
object ContextId;
[WmiDataId(2),
Description("Error code") : amended,
format("x"),
read]
uint32 ErrorCode;
};
[Dynamic,
Description("Receiving callback from WinHttp") : amended,
EventType(6),
EventLevel(4),
EventTypeName("ANCM_WINHTTP_CALLBACK") : amended
]
class ANCMWinHttpCallBack:ANCM_Events
{
[WmiDataId(1),
Description("Context ID") : amended,
extension("Guid"),
ActivityID,
read]
object ContextId;
[WmiDataId(2),
Description("InternetStatus") : amended,
format("x"),
read]
uint32 InternetStatus;
};
[Dynamic,
Description("Inprocess executing request failure") : amended,
EventType(7),
EventLevel(2),
EventTypeName("ANCM_EXECUTE_REQUEST_FAIL") : amended
]
class ANCMExecuteFailed:ANCM_Events
{
[WmiDataId(1),
Description("Context ID") : amended,
extension("Guid"),
ActivityID,
read]
object ContextId;
[WmiDataId(2),
Description("InternetStatus") : amended,
format("x"),
read]
uint32 ErrorCode;
};

View File

@ -0,0 +1,47 @@
<!--
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,1"/>
<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>
<element name="handlerSettings">
<collection addElement="handlerSetting" clearElement="clear" >
<attribute name="name" type="string" required="true" validationType="nonEmptyString"/>
<attribute name="value" type="string" required="true"/>
</collection>
</element>
</sectionSchema>
</configSchema>

View File

@ -0,0 +1,120 @@
// Microsoft Visual C++ generated resource script.
//
#include <windows.h>
#include "version.h"
#include "..\CommonLib\Aspnetcore_msg.rc"
#include "..\CommonLib\resources.h"
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#define FileDescription "IIS AspNetCore Module. Commit: " CommitHash
/////////////////////////////////////////////////////////////////////////////
//
// 11
//
//1 11
//BEGIN
// 0x0001, 0x0000, 0x03e8, 0x0000, 0x03ed, 0x0000, 0x0010, 0x0000, 0x0010,
// 0x0001, 0x0025, 0x0031, 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001,
// 0x0025, 0x0031, 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025,
// 0x0031, 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, 0x0031,
// 0x000d, 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, 0x0031, 0x000d,
// 0x000a, 0x0000, 0x0000, 0x0010, 0x0001, 0x0025, 0x0031, 0x000d, 0x000a,
// 0x0000, 0x0000
//END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"..\CommonLib\resources.h\0"
END
2 TEXTINCLUDE
BEGIN
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION FileVersion
PRODUCTVERSION ProductVersion
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Microsoft Corporation"
VALUE "FileDescription", FileDescription
VALUE "FileVersion", FileVersionStr
VALUE "InternalName", "aspnetcore"
VALUE "LegalCopyright", "Copyright (C) Microsoft Corporation"
VALUE "OriginalFilename", "aspnetcoreV2.dll"
VALUE "ProductName", "ASP.NET Core Module"
VALUE "ProductVersion", ProductVersionStr
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_INVALID_PROPERTY "Property name '%s' in system.webServer/aspNetCore section has invalid value '%s' which does not conform to the prescribed format"
IDS_SERVER_ERROR "There was a connection error while trying to route the request."
END
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,644 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#include "precomp.hxx"
APPLICATION_INFO::~APPLICATION_INFO()
{
if (m_pAppOfflineHtm != NULL)
{
m_pAppOfflineHtm->DereferenceAppOfflineHtm();
m_pAppOfflineHtm = NULL;
}
if (m_pFileWatcherEntry != NULL)
{
// Mark the entry as invalid,
// StopMonitor will close the file handle and trigger a FCN
// the entry will delete itself when processing this FCN
m_pFileWatcherEntry->MarkEntryInValid();
m_pFileWatcherEntry->StopMonitor();
m_pFileWatcherEntry = NULL;
}
if (m_pApplication != NULL)
{
// shutdown the application
m_pApplication->ShutDown();
m_pApplication->DereferenceApplication();
m_pApplication = NULL;
}
// configuration should be dereferenced after application shutdown
// since the former will use it during shutdown
if (m_pConfiguration != NULL)
{
// Need to dereference the configuration instance
m_pConfiguration->DereferenceConfiguration();
m_pConfiguration = NULL;
}
}
HRESULT
APPLICATION_INFO::Initialize(
_In_ ASPNETCORE_CONFIG *pConfiguration,
_In_ FILE_WATCHER *pFileWatcher
)
{
HRESULT hr = S_OK;
DBG_ASSERT(pConfiguration);
DBG_ASSERT(pFileWatcher);
m_pConfiguration = pConfiguration;
// reference the configuration instance to prevent it will be not release
// earlier in case of configuration change and shutdown
m_pConfiguration->ReferenceConfiguration();
hr = m_applicationInfoKey.Initialize(pConfiguration->QueryConfigPath()->QueryStr());
if (FAILED(hr))
{
goto Finished;
}
if (m_pFileWatcherEntry == NULL)
{
m_pFileWatcherEntry = new FILE_WATCHER_ENTRY(pFileWatcher);
if (m_pFileWatcherEntry == NULL)
{
hr = E_OUTOFMEMORY;
goto Finished;
}
}
UpdateAppOfflineFileHandle();
Finished:
return hr;
}
HRESULT
APPLICATION_INFO::StartMonitoringAppOffline()
{
HRESULT hr = S_OK;
if (m_pFileWatcherEntry != NULL)
{
hr = m_pFileWatcherEntry->Create(m_pConfiguration->QueryApplicationPhysicalPath()->QueryStr(), L"app_offline.htm", this, NULL);
}
return hr;
}
//
// Called by the file watcher when the app_offline.htm's file status has been changed.
// If it finds it, we will call recycle on the application.
//
VOID
APPLICATION_INFO::UpdateAppOfflineFileHandle()
{
STRU strFilePath;
UTILITY::ConvertPathToFullPath(L".\\app_offline.htm",
m_pConfiguration->QueryApplicationPhysicalPath()->QueryStr(),
&strFilePath);
APP_OFFLINE_HTM *pOldAppOfflineHtm = NULL;
APP_OFFLINE_HTM *pNewAppOfflineHtm = NULL;
ReferenceApplicationInfo();
if (INVALID_FILE_ATTRIBUTES == GetFileAttributes(strFilePath.QueryStr()) &&
GetLastError() == ERROR_FILE_NOT_FOUND)
{
// Check if app offline was originally present.
// if it was, log that app_offline has been dropped.
if (m_fAppOfflineFound)
{
STACK_STRU(strEventMsg, 256);
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_REMOVED_MSG)))
{
UTILITY::LogEvent(g_hEventLog,
EVENTLOG_INFORMATION_TYPE,
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_REMOVED,
strEventMsg.QueryStr());
}
}
m_fAppOfflineFound = FALSE;
}
else
{
pNewAppOfflineHtm = new APP_OFFLINE_HTM(strFilePath.QueryStr());
if (pNewAppOfflineHtm != NULL)
{
if (pNewAppOfflineHtm->Load())
{
//
// loaded the new app_offline.htm
//
pOldAppOfflineHtm = (APP_OFFLINE_HTM *)InterlockedExchangePointer((VOID**)&m_pAppOfflineHtm, pNewAppOfflineHtm);
if (pOldAppOfflineHtm != NULL)
{
pOldAppOfflineHtm->DereferenceAppOfflineHtm();
pOldAppOfflineHtm = NULL;
}
}
else
{
// ignored the new app_offline file because the file does not exist.
pNewAppOfflineHtm->DereferenceAppOfflineHtm();
pNewAppOfflineHtm = NULL;
}
}
m_fAppOfflineFound = TRUE;
// recycle the application
if (m_pApplication != NULL)
{
STACK_STRU(strEventMsg, 256);
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_MSG,
m_pApplication->QueryConfig()->QueryApplicationPath()->QueryStr())))
{
UTILITY::LogEvent(g_hEventLog,
EVENTLOG_INFORMATION_TYPE,
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE,
strEventMsg.QueryStr());
}
RecycleApplication();
}
}
DereferenceApplicationInfo();
}
HRESULT
APPLICATION_INFO::EnsureApplicationCreated()
{
HRESULT hr = S_OK;
BOOL fLocked = FALSE;
APPLICATION* pApplication = NULL;
STACK_STRU(struFileName, 300); // >MAX_PATH
STRU struHostFxrDllLocation;
if (m_pApplication != NULL)
{
goto Finished;
}
if (m_pApplication == NULL)
{
AcquireSRWLockExclusive(&m_srwLock);
fLocked = TRUE;
if (m_pApplication != NULL)
{
goto Finished;
}
//
// in case of app offline, we don't want to create a new application now
//
if (!m_fAppOfflineFound)
{
// Move the request handler check inside of the lock
// such that only one request finds and loads it.
// FindRequestHandlerAssembly obtains a global lock, but after releasing the lock,
// there is a period where we could call
hr = FindRequestHandlerAssembly();
if (FAILED(hr))
{
goto Finished;
}
if (m_pfnAspNetCoreCreateApplication == NULL)
{
hr = HRESULT_FROM_WIN32(ERROR_INVALID_FUNCTION);
goto Finished;
}
hr = m_pfnAspNetCoreCreateApplication(m_pServer, m_pConfiguration, &pApplication);
if (FAILED(hr))
{
goto Finished;
}
m_pApplication = pApplication;
}
}
Finished:
if (fLocked)
{
ReleaseSRWLockExclusive(&m_srwLock);
}
return hr;
}
HRESULT
APPLICATION_INFO::FindRequestHandlerAssembly()
{
HRESULT hr = S_OK;
BOOL fLocked = FALSE;
STACK_STRU(struFileName, 256);
if (g_fAspnetcoreRHLoadedError)
{
hr = E_APPLICATION_ACTIVATION_EXEC_FAILURE;
goto Finished;
}
else if (!g_fAspnetcoreRHAssemblyLoaded)
{
AcquireSRWLockExclusive(&g_srwLock);
fLocked = TRUE;
if (g_fAspnetcoreRHLoadedError)
{
hr = E_APPLICATION_ACTIVATION_EXEC_FAILURE;
goto Finished;
}
if (g_fAspnetcoreRHAssemblyLoaded)
{
goto Finished;
}
if (m_pConfiguration->QueryHostingModel() == APP_HOSTING_MODEL::HOSTING_IN_PROCESS)
{
if (FAILED(hr = FindNativeAssemblyFromHostfxr(&struFileName)))
{
STACK_STRU(strEventMsg, 256);
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
ASPNETCORE_EVENT_INPROCESS_RH_MISSING_MSG)))
{
UTILITY::LogEvent(g_hEventLog,
EVENTLOG_INFORMATION_TYPE,
ASPNETCORE_EVENT_INPROCESS_RH_MISSING,
strEventMsg.QueryStr());
}
goto Finished;
}
}
else
{
if (FAILED(hr = FindNativeAssemblyFromGlobalLocation(&struFileName)))
{
STACK_STRU(strEventMsg, 256);
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
ASPNETCORE_EVENT_OUT_OF_PROCESS_RH_MISSING_MSG)))
{
UTILITY::LogEvent(g_hEventLog,
EVENTLOG_INFORMATION_TYPE,
ASPNETCORE_EVENT_OUT_OF_PROCESS_RH_MISSING,
strEventMsg.QueryStr());
}
goto Finished;
}
}
g_hAspnetCoreRH = LoadLibraryW(struFileName.QueryStr());
if (g_hAspnetCoreRH == NULL)
{
hr = HRESULT_FROM_WIN32(GetLastError());
goto Finished;
}
g_pfnAspNetCoreCreateApplication = (PFN_ASPNETCORE_CREATE_APPLICATION)
GetProcAddress(g_hAspnetCoreRH, "CreateApplication");
if (g_pfnAspNetCoreCreateApplication == NULL)
{
hr = HRESULT_FROM_WIN32(GetLastError());
goto Finished;
}
g_pfnAspNetCoreCreateRequestHandler = (PFN_ASPNETCORE_CREATE_REQUEST_HANDLER)
GetProcAddress(g_hAspnetCoreRH, "CreateRequestHandler");
if (g_pfnAspNetCoreCreateRequestHandler == NULL)
{
hr = HRESULT_FROM_WIN32(GetLastError());
goto Finished;
}
g_fAspnetcoreRHAssemblyLoaded = TRUE;
}
Finished:
//
// Question: we remember the load failure so that we will not try again.
// User needs to check whether the fuction pointer is NULL
//
m_pfnAspNetCoreCreateApplication = g_pfnAspNetCoreCreateApplication;
m_pfnAspNetCoreCreateRequestHandler = g_pfnAspNetCoreCreateRequestHandler;
if (!g_fAspnetcoreRHLoadedError && FAILED(hr))
{
g_fAspnetcoreRHLoadedError = TRUE;
}
if (fLocked)
{
ReleaseSRWLockExclusive(&g_srwLock);
}
return hr;
}
HRESULT
APPLICATION_INFO::FindNativeAssemblyFromGlobalLocation(STRU* struFilename)
{
HRESULT hr = S_OK;
DWORD dwSize = MAX_PATH;
BOOL fDone = FALSE;
DWORD dwPosition = 0;
// Though we could call LoadLibrary(L"aspnetcorerh.dll") relying the OS to solve
// the path (the targeted dll is the same folder of w3wp.exe/iisexpress)
// let's still load with full path to avoid security issue
if (FAILED(hr = struFilename->Resize(dwSize + 20)))
{
goto Finished;
}
while (!fDone)
{
DWORD dwReturnedSize = GetModuleFileNameW(g_hModule, struFilename->QueryStr(), dwSize);
if (dwReturnedSize == 0)
{
hr = HRESULT_FROM_WIN32(GetLastError());
fDone = TRUE;
goto Finished;
}
else if ((dwReturnedSize == dwSize) && (GetLastError() == ERROR_INSUFFICIENT_BUFFER))
{
dwSize *= 2; // smaller buffer. increase the buffer and retry
if (FAILED(hr = struFilename->Resize(dwSize + 20))) // + 20 for aspnetcorerh.dll
{
goto Finished;
}
}
else
{
fDone = TRUE;
}
}
if (FAILED(hr = struFilename->SyncWithBuffer()))
{
goto Finished;
}
dwPosition = struFilename->LastIndexOf(L'\\', 0);
struFilename->QueryStr()[dwPosition] = L'\0';
if (FAILED(hr = struFilename->SyncWithBuffer()) ||
FAILED(hr = struFilename->Append(L"\\")) ||
FAILED(hr = struFilename->Append(g_pwzAspnetcoreRequestHandlerName)))
{
goto Finished;
}
Finished:
return hr;
}
//
// Tries to find aspnetcorerh.dll from the application
// Calls into hostfxr.dll to find it.
// Will leave hostfxr.dll loaded as it will be used again to call hostfxr_main.
//
HRESULT
APPLICATION_INFO::FindNativeAssemblyFromHostfxr(
STRU* struFilename
)
{
HRESULT hr = S_OK;
STRU struApplicationFullPath;
STRU struNativeSearchPaths;
STRU struNativeDllLocation;
HMODULE hmHostFxrDll = NULL;
INT intHostFxrExitCode = 0;
INT intIndex = -1;
INT intPrevIndex = 0;
BOOL fFound = FALSE;
DWORD dwBufferSize = 1024 * 10;
DWORD dwRequiredBufferSize = 0;
DBG_ASSERT(struFileName != NULL);
hmHostFxrDll = LoadLibraryW(m_pConfiguration->QueryHostFxrFullPath());
if (hmHostFxrDll == NULL)
{
// Could not load hostfxr
hr = HRESULT_FROM_WIN32(GetLastError());
goto Finished;
}
hostfxr_get_native_search_directories_fn pFnHostFxrSearchDirectories = (hostfxr_get_native_search_directories_fn)
GetProcAddress(hmHostFxrDll, "hostfxr_get_native_search_directories");
if (pFnHostFxrSearchDirectories == NULL)
{
// Host fxr version is incorrect (need a higher version).
// TODO log error
hr = E_FAIL;
goto Finished;
}
if (FAILED(hr = struNativeSearchPaths.Resize(dwBufferSize)))
{
goto Finished;
}
while (TRUE)
{
intHostFxrExitCode = pFnHostFxrSearchDirectories(
m_pConfiguration->QueryHostFxrArgCount(),
m_pConfiguration->QueryHostFxrArguments(),
struNativeSearchPaths.QueryStr(),
dwBufferSize,
&dwRequiredBufferSize
);
if (intHostFxrExitCode == 0)
{
break;
}
else if (dwRequiredBufferSize > dwBufferSize)
{
dwBufferSize = dwRequiredBufferSize + 1; // for null terminator
if (FAILED(hr = struNativeSearchPaths.Resize(dwBufferSize)))
{
goto Finished;
}
}
else
{
hr = E_FAIL;
// Log "Error finding native search directories from aspnetcore application.
goto Finished;
}
}
if (FAILED(hr = struNativeSearchPaths.SyncWithBuffer()))
{
goto Finished;
}
fFound = FALSE;
// The native search directories are semicolon delimited.
// Split on semicolons, append aspnetcorerh.dll, and check if the file exists.
while ((intIndex = struNativeSearchPaths.IndexOf(L";", intPrevIndex)) != -1)
{
if (FAILED(hr = struNativeDllLocation.Copy(&struNativeSearchPaths.QueryStr()[intPrevIndex], intIndex - intPrevIndex)))
{
goto Finished;
}
if (!struNativeDllLocation.EndsWith(L"\\"))
{
if (FAILED(hr = struNativeDllLocation.Append(L"\\")))
{
goto Finished;
}
}
if (FAILED(hr = struNativeDllLocation.Append(g_pwzAspnetcoreRequestHandlerName)))
{
goto Finished;
}
if (UTILITY::CheckIfFileExists(struNativeDllLocation.QueryStr()))
{
if (FAILED(hr = struFilename->Copy(struNativeDllLocation)))
{
goto Finished;
}
fFound = TRUE;
break;
}
intPrevIndex = intIndex + 1;
}
if (!fFound)
{
hr = E_FAIL;
goto Finished;
}
Finished:
if (FAILED(hr) && hmHostFxrDll != NULL)
{
FreeLibrary(hmHostFxrDll);
}
return hr;
}
VOID
APPLICATION_INFO::RecycleApplication()
{
APPLICATION* pApplication = NULL;
HANDLE hThread = INVALID_HANDLE_VALUE;
BOOL fLockAcquired = FALSE;
if (m_pApplication != NULL)
{
AcquireSRWLockExclusive(&m_srwLock);
fLockAcquired = TRUE;
if (m_pApplication != NULL)
{
pApplication = m_pApplication;
if (pApplication->QueryConfig()->QueryHostingModel() == HOSTING_OUT_PROCESS)
{
//
// For inprocess, need to set m_pApplication to NULL first to
// avoid mapping new request to the recycled application.
// Outofprocess application instance will be created for new request
// For inprocess, as recycle will lead to shutdown later, leave m_pApplication
// to not block incoming requests till worker process shutdown
//
m_pApplication = NULL;
}
else
{
//
// For inprocess, need hold the application till shutdown is called
// Bump the reference counter as DoRecycleApplication will do dereference
//
pApplication->ReferenceApplication();
}
hThread = CreateThread(
NULL, // default security attributes
0, // default stack size
(LPTHREAD_START_ROUTINE)DoRecycleApplication,
pApplication, // thread function arguments
0, // default creation flags
NULL); // receive thread identifier
}
if (hThread == NULL)
{
if (!g_fRecycleProcessCalled)
{
g_fRecycleProcessCalled = TRUE;
g_pHttpServer->RecycleProcess(L"On Demand by AspNetCore Module for recycle application failure");
}
}
if (fLockAcquired)
{
ReleaseSRWLockExclusive(&m_srwLock);
}
}
}
VOID
APPLICATION_INFO::DoRecycleApplication(
LPVOID lpParam)
{
APPLICATION* pApplication = static_cast<APPLICATION*>(lpParam);
// No lock required
if (pApplication != NULL)
{
// Recycle will call shutdown for out of process
pApplication->Recycle();
// Decrement the ref count as we reference it in RecycleApplication.
pApplication->DereferenceApplication();
}
}
VOID
APPLICATION_INFO::ShutDownApplication()
{
APPLICATION* pApplication = NULL;
BOOL fLockAcquired = FALSE;
// pApplication can be NULL due to app_offline
if (m_pApplication != NULL)
{
AcquireSRWLockExclusive(&m_srwLock);
fLockAcquired = TRUE;
if (m_pApplication != NULL)
{
pApplication = m_pApplication;
// Set m_pApplication to NULL first to prevent anyone from using it
m_pApplication = NULL;
pApplication->ShutDown();
pApplication->DereferenceApplication();
}
if (fLockAcquired)
{
ReleaseSRWLockExclusive(&m_srwLock);
}
}
}

View File

@ -0,0 +1,458 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#include "precomp.hxx"
// The application manager is a singleton across ANCM.
APPLICATION_MANAGER* APPLICATION_MANAGER::sm_pApplicationManager = NULL;
//
// Retrieves the application info from the application manager
// Will create the application info if it isn't initalized
//
HRESULT
APPLICATION_MANAGER::GetOrCreateApplicationInfo(
_In_ IHttpServer* pServer,
_In_ ASPNETCORE_CONFIG* pConfig,
_Out_ APPLICATION_INFO ** ppApplicationInfo
)
{
HRESULT hr = S_OK;
APPLICATION_INFO *pApplicationInfo = NULL;
APPLICATION_INFO_KEY key;
BOOL fExclusiveLock = FALSE;
BOOL fMixedHostingModelError = FALSE;
BOOL fDuplicatedInProcessApp = FALSE;
PCWSTR pszApplicationId = NULL;
STACK_STRU ( strEventMsg, 256 );
DBG_ASSERT(pServer);
DBG_ASSERT(pConfig);
DBG_ASSERT(ppApplicationInfo);
*ppApplicationInfo = NULL;
// The configuration path is unique for each application and is used for the
// key in the applicationInfoHash.
pszApplicationId = pConfig->QueryConfigPath()->QueryStr();
hr = key.Initialize(pszApplicationId);
if (FAILED(hr))
{
goto Finished;
}
// When accessing the m_pApplicationInfoHash, we need to acquire the application manager
// lock to avoid races on setting state.
AcquireSRWLockShared(&m_srwLock);
if (g_fInShutdown)
{
ReleaseSRWLockShared(&m_srwLock);
hr = HRESULT_FROM_WIN32(ERROR_SERVER_SHUTDOWN_IN_PROGRESS);
goto Finished;
}
m_pApplicationInfoHash->FindKey(&key, ppApplicationInfo);
ReleaseSRWLockShared(&m_srwLock);
if (*ppApplicationInfo == NULL)
{
// Check which hosting model we want to support
switch (pConfig->QueryHostingModel())
{
case HOSTING_IN_PROCESS:
if (m_pApplicationInfoHash->Count() > 0)
{
// Only one inprocess app is allowed per IIS worker process
fDuplicatedInProcessApp = TRUE;
hr = HRESULT_FROM_WIN32(ERROR_APP_INIT_FAILURE);
goto Finished;
}
break;
case HOSTING_OUT_PROCESS:
break;
default:
hr = E_UNEXPECTED;
goto Finished;
}
pApplicationInfo = new APPLICATION_INFO(pServer);
if (pApplicationInfo == NULL)
{
hr = E_OUTOFMEMORY;
goto Finished;
}
AcquireSRWLockExclusive(&m_srwLock);
fExclusiveLock = TRUE;
if (g_fInShutdown)
{
// Already in shuting down. No need to create the application
hr = HRESULT_FROM_WIN32(ERROR_SERVER_SHUTDOWN_IN_PROGRESS);
goto Finished;
}
m_pApplicationInfoHash->FindKey(&key, ppApplicationInfo);
if (*ppApplicationInfo != NULL)
{
// someone else created the application
delete pApplicationInfo;
pApplicationInfo = NULL;
goto Finished;
}
// hosting model check. We do not allow mixed scenario for now
// could be changed in the future
if (m_hostingModel != HOSTING_UNKNOWN)
{
if (m_hostingModel != pConfig->QueryHostingModel())
{
// hosting model does not match, error out
fMixedHostingModelError = TRUE;
hr = HRESULT_FROM_WIN32(ERROR_APP_INIT_FAILURE);
goto Finished;
}
}
hr = pApplicationInfo->Initialize(pConfig, m_pFileWatcher);
if (FAILED(hr))
{
goto Finished;
}
hr = m_pApplicationInfoHash->InsertRecord( pApplicationInfo );
if (FAILED(hr))
{
goto Finished;
}
//
// first application will decide which hosting model allowed by this process
//
if (m_hostingModel == HOSTING_UNKNOWN)
{
m_hostingModel = pConfig->QueryHostingModel();
}
*ppApplicationInfo = pApplicationInfo;
pApplicationInfo->StartMonitoringAppOffline();
// Release the locko after starting to monitor for app offline to avoid races with it being dropped.
ReleaseSRWLockExclusive(&m_srwLock);
fExclusiveLock = FALSE;
pApplicationInfo = NULL;
}
Finished:
if (fExclusiveLock)
{
ReleaseSRWLockExclusive(&m_srwLock);
}
if (pApplicationInfo != NULL)
{
pApplicationInfo->DereferenceApplicationInfo();
pApplicationInfo = NULL;
}
if (FAILED(hr))
{
if (fDuplicatedInProcessApp)
{
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
ASPNETCORE_EVENT_DUPLICATED_INPROCESS_APP_MSG,
pszApplicationId)))
{
UTILITY::LogEvent(g_hEventLog,
EVENTLOG_ERROR_TYPE,
ASPNETCORE_EVENT_DUPLICATED_INPROCESS_APP,
strEventMsg.QueryStr());
}
}
else if (fMixedHostingModelError)
{
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
ASPNETCORE_EVENT_MIXED_HOSTING_MODEL_ERROR_MSG,
pszApplicationId,
pConfig->QueryHostingModel())))
{
UTILITY::LogEvent(g_hEventLog,
EVENTLOG_ERROR_TYPE,
ASPNETCORE_EVENT_MIXED_HOSTING_MODEL_ERROR,
strEventMsg.QueryStr());
}
}
else
{
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
ASPNETCORE_EVENT_ADD_APPLICATION_ERROR_MSG,
pszApplicationId,
hr)))
{
UTILITY::LogEvent(g_hEventLog,
EVENTLOG_ERROR_TYPE,
ASPNETCORE_EVENT_ADD_APPLICATION_ERROR,
strEventMsg.QueryStr());
}
}
}
return hr;
}
//
// If the application's configuration was changed,
// append the configuration path to the config change context.
//
BOOL
APPLICATION_MANAGER::FindConfigChangedApplication(
_In_ APPLICATION_INFO * pEntry,
_In_ PVOID pvContext)
{
DBG_ASSERT(pEntry);
DBG_ASSERT(pvContext);
// Config Change context contains the original config path that changed
// and a multiStr containing
CONFIG_CHANGE_CONTEXT* pContext = static_cast<CONFIG_CHANGE_CONTEXT*>(pvContext);
STRU* pstruConfigPath = pEntry->QueryConfig()->QueryConfigPath();
// check if the application path contains our app/subapp by seeing if the config path
// starts with the notification path.
BOOL fChanged = pstruConfigPath->StartsWith(pContext->pstrPath, true);
if (fChanged)
{
DWORD dwLen = (DWORD)wcslen(pContext->pstrPath);
WCHAR wChar = pstruConfigPath->QueryStr()[dwLen];
// We need to check that the last character of the config path
// is either a null terminator or a slash.
// This checks the case where the config path was
// MACHINE/WEBROOT/site and your site path is MACHINE/WEBROOT/siteTest
if (wChar != L'\0' && wChar != L'/')
{
// not current app or sub app
fChanged = FALSE;
}
else
{
pContext->MultiSz.Append(*pstruConfigPath);
}
}
return fChanged;
}
//
// Finds any applications affected by a configuration change and calls Recycle on them
// InProcess: Triggers g_httpServer->RecycleProcess() and keep the application inside of the manager.
// This will cause a shutdown event to occur through the global stop listening event.
// OutOfProcess: Removes all applications in the application manager and calls Recycle, which will call Shutdown,
// on each application.
//
HRESULT
APPLICATION_MANAGER::RecycleApplicationFromManager(
_In_ LPCWSTR pszApplicationId
)
{
HRESULT hr = S_OK;
APPLICATION_INFO_KEY key;
DWORD dwPreviousCounter = 0;
APPLICATION_INFO_HASH* table = NULL;
CONFIG_CHANGE_CONTEXT context;
BOOL fKeepTable = FALSE;
if (g_fInShutdown)
{
// We are already shutting down, ignore this event as a global configuration change event
// can occur after global stop listening for some reason.
return hr;
}
AcquireSRWLockExclusive(&m_srwLock);
if (g_fInShutdown)
{
ReleaseSRWLockExclusive(&m_srwLock);
return hr;
}
hr = key.Initialize(pszApplicationId);
if (FAILED(hr))
{
goto Finished;
}
// Make a shallow copy of existing hashtable as we may need to remove nodes
// This will be used for finding differences in which applications are affected by a config change.
table = new APPLICATION_INFO_HASH();
if (table == NULL)
{
hr = E_OUTOFMEMORY;
goto Finished;
}
// few application expected, small bucket size for hash table
if (FAILED(hr = table->Initialize(17 /*prime*/)))
{
goto Finished;
}
context.pstrPath = pszApplicationId;
// Keep track of the preview count of applications to know whether there are applications to delete
dwPreviousCounter = m_pApplicationInfoHash->Count();
// We don't want to hold the application manager lock for long time as it will block all incoming requests
// Don't call application shutdown inside the lock
m_pApplicationInfoHash->Apply(APPLICATION_INFO_HASH::ReferenceCopyToTable, static_cast<PVOID>(table));
DBG_ASSERT(dwPreviousCounter == table->Count());
// Removed the applications which are impacted by the configurtion change
m_pApplicationInfoHash->DeleteIf(FindConfigChangedApplication, (PVOID)&context);
if (dwPreviousCounter != m_pApplicationInfoHash->Count())
{
if (m_hostingModel == HOSTING_IN_PROCESS)
{
// When we are inprocess, we need to keep the application the
// application manager that is being deleted. This is because we will always need to recycle the worker
// process and any requests that hit this worker process must be rejected (while out of process can
// start a new dotnet process). We will immediately call Recycle after this call.
DBG_ASSERT(m_pApplicationInfoHash->Count() == 0);
delete m_pApplicationInfoHash;
// We don't want to delete the table as m_pApplicationInfoHash = table
fKeepTable = TRUE;
m_pApplicationInfoHash = table;
}
}
if (m_pApplicationInfoHash->Count() == 0)
{
m_hostingModel = HOSTING_UNKNOWN;
}
ReleaseSRWLockExclusive(&m_srwLock);
// If we receive a request at this point.
// OutOfProcess: we will create a new application with new configuration
// InProcess: the request would have to be rejected, as we are about to call g_HttpServer->RecycleProcess
// on the worker proocess
if (!context.MultiSz.IsEmpty())
{
PCWSTR path = context.MultiSz.First();
// Iterate through each of the paths that were shut down,
// calling RecycleApplication on each of them.
while (path != NULL)
{
APPLICATION_INFO* pRecord;
// Application got recycled. Log an event
STACK_STRU(strEventMsg, 256);
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
ASPNETCORE_EVENT_RECYCLE_CONFIGURATION_MSG,
path)))
{
UTILITY::LogEvent(g_hEventLog,
EVENTLOG_INFORMATION_TYPE,
ASPNETCORE_EVENT_RECYCLE_CONFIGURATION,
strEventMsg.QueryStr());
}
hr = key.Initialize(path);
if (FAILED(hr))
{
goto Finished;
}
table->FindKey(&key, &pRecord);
DBG_ASSERT(pRecord != NULL);
// RecycleApplication is called on a separate thread.
pRecord->RecycleApplication();
pRecord->DereferenceApplicationInfo();
path = context.MultiSz.Next(path);
}
}
Finished:
if (table != NULL && !fKeepTable)
{
table->Clear();
delete table;
}
if (FAILED(hr))
{
// Failed to recycle an application. Log an event
STACK_STRU(strEventMsg, 256);
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
ASPNETCORE_EVENT_RECYCLE_FAILURE_CONFIGURATION_MSG,
pszApplicationId)))
{
UTILITY::LogEvent(g_hEventLog,
EVENTLOG_ERROR_TYPE,
ASPNETCORE_EVENT_RECYCLE_APP_FAILURE,
strEventMsg.QueryStr());
}
// Need to recycle the process as we cannot recycle the application
if (!g_fRecycleProcessCalled)
{
g_fRecycleProcessCalled = TRUE;
g_pHttpServer->RecycleProcess(L"AspNetCore Recycle Process on Demand Due Application Recycle Error");
}
}
return hr;
}
//
// Shutsdown all applications in the application hashtable
// Only called by OnGlobalStopListening.
//
VOID
APPLICATION_MANAGER::ShutDown()
{
// We are guaranteed to only have one outstanding OnGlobalStopListening event at a time
// However, it is possible to receive multiple OnGlobalStopListening events
// Protect against this by checking if we already shut down.
g_fInShutdown = TRUE;
if (m_pApplicationInfoHash != NULL)
{
if (m_pFileWatcher != NULL)
{
delete m_pFileWatcher;
m_pFileWatcher = NULL;
}
DBG_ASSERT(m_pApplicationInfoHash);
// During shutdown we lock until we delete the application
AcquireSRWLockExclusive(&m_srwLock);
// Call shutdown on each application in the application manager
m_pApplicationInfoHash->Apply(ShutdownApplication, NULL);
m_pApplicationInfoHash->Clear();
delete m_pApplicationInfoHash;
m_pApplicationInfoHash = NULL;
ReleaseSRWLockExclusive(&m_srwLock);
}
}
//
// Calls shutdown on each application. ApplicationManager's lock is held for duration of
// each shutdown call, guaranteeing another application cannot be created.
//
// static
VOID
APPLICATION_MANAGER::ShutdownApplication(
_In_ APPLICATION_INFO * pEntry,
_In_ PVOID pvContext
)
{
UNREFERENCED_PARAMETER(pvContext);
DBG_ASSERT(pEntry != NULL);
pEntry->ShutDownApplication();
}

View File

@ -0,0 +1,254 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#include "precomp.hxx"
#include <IPHlpApi.h>
HTTP_MODULE_ID g_pModuleId = NULL;
IHttpServer * g_pHttpServer = NULL;
HANDLE g_hEventLog = NULL;
BOOL g_fRecycleProcessCalled = FALSE;
PCWSTR g_pszModuleName = NULL;
HINSTANCE g_hModule;
HMODULE g_hAspnetCoreRH = NULL;
BOOL g_fAspnetcoreRHAssemblyLoaded = FALSE;
BOOL g_fAspnetcoreRHLoadedError = FALSE;
BOOL g_fInShutdown = FALSE;
DWORD g_dwAspNetCoreDebugFlags = 0;
DWORD g_dwActiveServerProcesses = 0;
SRWLOCK g_srwLock;
DWORD g_dwDebugFlags = 0;
PCSTR g_szDebugLabel = "ASPNET_CORE_MODULE";
PCWSTR g_pwzAspnetcoreRequestHandlerName = L"aspnetcorerh.dll";
PFN_ASPNETCORE_CREATE_APPLICATION g_pfnAspNetCoreCreateApplication;
PFN_ASPNETCORE_CREATE_REQUEST_HANDLER g_pfnAspNetCoreCreateRequestHandler;
VOID
StaticCleanup()
{
APPLICATION_MANAGER::Cleanup();
if (g_hEventLog != NULL)
{
DeregisterEventSource(g_hEventLog);
g_hEventLog = NULL;
}
}
BOOL WINAPI DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
UNREFERENCED_PARAMETER(lpReserved);
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
g_hModule = hModule;
DisableThreadLibraryCalls(hModule);
break;
case DLL_PROCESS_DETACH:
// IIS can cause dll detach to occur before we receive global notifications
// For example, when we switch the bitness of the worker process,
// this is a bug in IIS. To try to avoid AVs, we will set a global flag
g_fInShutdown = TRUE;
StaticCleanup();
default:
break;
}
return TRUE;
}
HRESULT
__stdcall
RegisterModule(
DWORD dwServerVersion,
IHttpModuleRegistrationInfo * pModuleInfo,
IHttpServer * pHttpServer
)
/*++
Routine description:
Function called by IIS immediately after loading the module, used to let
IIS know what notifications the module is interested in
Arguments:
dwServerVersion - IIS version the module is being loaded on
pModuleInfo - info regarding this module
pHttpServer - callback functions which can be used by the module at
any point
Return value:
HRESULT
--*/
{
HRESULT hr = S_OK;
HKEY hKey;
BOOL fDisableANCM = FALSE;
ASPNET_CORE_PROXY_MODULE_FACTORY * pFactory = NULL;
ASPNET_CORE_GLOBAL_MODULE * pGlobalModule = NULL;
APPLICATION_MANAGER * pApplicationManager = NULL;
UNREFERENCED_PARAMETER(dwServerVersion);
#ifdef DEBUG
CREATE_DEBUG_PRINT_OBJECT("Asp.Net Core Module");
g_dwDebugFlags = DEBUG_FLAGS_ANY;
#endif // DEBUG
CREATE_DEBUG_PRINT_OBJECT;
//LoadGlobalConfiguration();
InitializeSRWLock(&g_srwLock);
g_pModuleId = pModuleInfo->GetId();
g_pszModuleName = pModuleInfo->GetName();
g_pHttpServer = pHttpServer;
if (g_pHttpServer->IsCommandLineLaunch())
{
g_hEventLog = RegisterEventSource(NULL, ASPNETCORE_IISEXPRESS_EVENT_PROVIDER);
}
else
{
g_hEventLog = RegisterEventSource(NULL, ASPNETCORE_EVENT_PROVIDER);
}
// check whether the feature is disabled due to security reason
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\IIS Extensions\\IIS AspNetCore Module\\Parameters",
0,
KEY_READ,
&hKey) == NO_ERROR)
{
DWORD dwType;
DWORD dwData;
DWORD cbData;
cbData = sizeof(dwData);
if ((RegQueryValueEx(hKey,
L"DisableANCM",
NULL,
&dwType,
(LPBYTE)&dwData,
&cbData) == NO_ERROR) &&
(dwType == REG_DWORD))
{
fDisableANCM = (dwData != 0);
}
cbData = sizeof(dwData);
if ((RegQueryValueEx(hKey,
L"DebugFlags",
NULL,
&dwType,
(LPBYTE)&dwData,
&cbData) == NO_ERROR) &&
(dwType == REG_DWORD))
{
g_dwAspNetCoreDebugFlags = dwData;
}
RegCloseKey(hKey);
}
if (fDisableANCM)
{
// Logging
STACK_STRU(strEventMsg, 256);
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
ASPNETCORE_EVENT_MODULE_DISABLED_MSG)))
{
UTILITY::LogEvent(g_hEventLog,
EVENTLOG_WARNING_TYPE,
ASPNETCORE_EVENT_MODULE_DISABLED,
strEventMsg.QueryStr());
}
// this will return 500 error to client
// as we did not register the module
goto Finished;
}
//
// Create the factory before any static initialization.
// The ASPNET_CORE_PROXY_MODULE_FACTORY::Terminate method will clean any
// static object initialized.
//
pFactory = new ASPNET_CORE_PROXY_MODULE_FACTORY;
if (pFactory == NULL)
{
hr = E_OUTOFMEMORY;
goto Finished;
}
hr = pModuleInfo->SetRequestNotifications(
pFactory,
RQ_EXECUTE_REQUEST_HANDLER,
0);
if (FAILED(hr))
{
goto Finished;
}
pFactory = NULL;
pApplicationManager = APPLICATION_MANAGER::GetInstance();
if(pApplicationManager == NULL)
{
hr = E_OUTOFMEMORY;
goto Finished;
}
hr = pApplicationManager->Initialize();
if(FAILED(hr))
{
goto Finished;
}
pGlobalModule = NULL;
pGlobalModule = new ASPNET_CORE_GLOBAL_MODULE(pApplicationManager);
if (pGlobalModule == NULL)
{
hr = E_OUTOFMEMORY;
goto Finished;
}
hr = pModuleInfo->SetGlobalNotifications(
pGlobalModule,
GL_CONFIGURATION_CHANGE | // Configuration change trigers IIS application stop
GL_STOP_LISTENING); // worker process stop or recycle
if (FAILED(hr))
{
goto Finished;
}
pGlobalModule = NULL;
hr = ALLOC_CACHE_HANDLER::StaticInitialize();
if (FAILED(hr))
{
goto Finished;
}
Finished:
if (pGlobalModule != NULL)
{
delete pGlobalModule;
pGlobalModule = NULL;
}
if (pFactory != NULL)
{
pFactory->Terminate();
pFactory = NULL;
}
return hr;
}

View File

@ -0,0 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.
// This file is auto-generated
#define FileVersion 8,1,18099,0
#define FileVersionStr "8.1.18099.0\0"
#define ProductVersion 8,1,18099,0
#define ProductVersionStr "8.1.18099.0\0"
#define PlatformToolset "v141\0"
#define CommitHash "e07bcc3f9b123ef8dbde6a0328ef4c9f07ed73b0\0"

View File

@ -179,6 +179,7 @@
<ClInclude Include="hostfxr_utility.h" />
<ClInclude Include="requesthandler.h" />
<ClInclude Include="resources.h" />
<ClInclude Include="SRWLockWrapper.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="utility.h" />
</ItemGroup>
@ -188,6 +189,7 @@
<ClCompile Include="fx_ver.cxx" />
<ClCompile Include="hostfxr_utility.cpp" />
<ClCompile Include="requesthandler.cxx" />
<ClCompile Include="SRWLockWrapper.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>

Binary file not shown.

View File

@ -7,10 +7,10 @@ APPLICATION::APPLICATION(
_In_ IHttpServer* pHttpServer,
_In_ ASPNETCORE_CONFIG* pConfig) :
m_cRefs(1),
m_pHttpServer(pHttpServer),
m_pConfig(pConfig),
m_status(APPLICATION_STATUS::UNKNOWN)
{
UNREFERENCED_PARAMETER(pHttpServer);
}
APPLICATION::~APPLICATION()

View File

@ -18,7 +18,7 @@ class APPLICATION
{
public:
APPLICATION(
_In_ IHttpServer* pHttpServer,
_In_ IHttpServer* pHttpServer,
_In_ ASPNETCORE_CONFIG* pConfig);
virtual
@ -49,6 +49,5 @@ public:
protected:
mutable LONG m_cRefs;
volatile APPLICATION_STATUS m_status;
IHttpServer* m_pHttpServer;
ASPNETCORE_CONFIG* m_pConfig;
};

View File

@ -0,0 +1,328 @@
/*++
Copyright (c) .NET Foundation. All rights reserved.
Licensed under the MIT License. See License.txt in the project root for license information.
Module Name:
aspnetcore_msg.mc
Abstract:
Asp.Net Core Module localizable messages.
--*/
#ifndef _ASPNETCORE_MSG_H_
#define _ASPNETCORE_MSG_H_
//
// Values are 32 bit values laid out as follows:
//
// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
// +---+-+-+-----------------------+-------------------------------+
// |Sev|C|R| Facility | Code |
// +---+-+-+-----------------------+-------------------------------+
//
// where
//
// Sev - is the severity code
//
// 00 - Success
// 01 - Informational
// 10 - Warning
// 11 - Error
//
// C - is the Customer code flag
//
// R - is a reserved bit
//
// Facility - is the facility code
//
// Code - is the facility's status code
//
//
// Define the facility codes
//
//
// Define the severity codes
//
//
// MessageId: ASPNETCORE_EVENT_PROCESS_START_ERROR
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_PROCESS_START_ERROR ((DWORD)0x000003E8L)
//
// MessageId: ASPNETCORE_EVENT_PROCESS_START_SUCCESS
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_PROCESS_START_SUCCESS ((DWORD)0x000003E9L)
//
// MessageId: ASPNETCORE_EVENT_PROCESS_CRASH
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_PROCESS_CRASH ((DWORD)0x000003EAL)
//
// MessageId: ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_RAPID_FAIL_COUNT_EXCEEDED ((DWORD)0x000003EBL)
//
// MessageId: ASPNETCORE_EVENT_CONFIG_ERROR
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_CONFIG_ERROR ((DWORD)0x000003ECL)
//
// MessageId: ASPNETCORE_EVENT_GRACEFUL_SHUTDOWN_FAILURE
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_GRACEFUL_SHUTDOWN_FAILURE ((DWORD)0x000003EDL)
//
// MessageId: ASPNETCORE_EVENT_SENT_SHUTDOWN_HTTP_REQUEST
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_SENT_SHUTDOWN_HTTP_REQUEST ((DWORD)0x000003EEL)
//
// MessageId: ASPNETCORE_EVENT_LOAD_CLR_FALIURE
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_LOAD_CLR_FALIURE ((DWORD)0x000003EFL)
//
// MessageId: ASPNETCORE_EVENT_DUPLICATED_INPROCESS_APP
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_DUPLICATED_INPROCESS_APP ((DWORD)0x000003F0L)
//
// MessageId: ASPNETCORE_EVENT_MIXED_HOSTING_MODEL_ERROR
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_MIXED_HOSTING_MODEL_ERROR ((DWORD)0x000003F1L)
//
// MessageId: ASPNETCORE_EVENT_ADD_APPLICATION_ERROR
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_ADD_APPLICATION_ERROR ((DWORD)0x000003F2L)
//
// MessageId: ASPNETCORE_EVENT_INPROCESS_THREAD_EXIT
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_INPROCESS_THREAD_EXIT ((DWORD)0x000003F3L)
//
// MessageId: ASPNETCORE_EVENT_RECYCLE_APPOFFLINE
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_RECYCLE_APPOFFLINE ((DWORD)0x000003F4L)
//
// MessageId: ASPNETCORE_EVENT_MODULE_DISABLED
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_MODULE_DISABLED ((DWORD)0x000003F5L)
//
// MessageId: ASPNETCORE_EVENT_INPROCESS_FULL_FRAMEWORK_APP
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_INPROCESS_FULL_FRAMEWORK_APP ((DWORD)0x000003F6L)
//
// MessageId: ASPNETCORE_EVENT_PORTABLE_APP_DOTNET_MISSING
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_PORTABLE_APP_DOTNET_MISSING ((DWORD)0x000003F7L)
//
// MessageId: ASPNETCORE_EVENT_HOSTFXR_DIRECTORY_NOT_FOUND
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_HOSTFXR_DIRECTORY_NOT_FOUND ((DWORD)0x000003F8L)
//
// MessageId: ASPNETCORE_EVENT_HOSTFXR_DLL_NOT_FOUND
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_HOSTFXR_DLL_NOT_FOUND ((DWORD)0x000003F9L)
//
// MessageId: ASPNETCORE_EVENT_INPROCESS_THREAD_EXCEPTION
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_INPROCESS_THREAD_EXCEPTION ((DWORD)0x000003FAL)
//
// MessageId: ASPNETCORE_EVENT_APPLICATION_EXE_NOT_FOUND
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_APPLICATION_EXE_NOT_FOUND ((DWORD)0x000003FBL)
//
// MessageId: ASPNETCORE_EVENT_PROCESS_START_FAILURE
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_PROCESS_START_FAILURE ((DWORD)0x000003FCL)
//
// MessageId: ASPNETCORE_EVENT_RECYCLE_CONFIGURATION
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_RECYCLE_CONFIGURATION ((DWORD)0x000003FDL)
//
// MessageId: ASPNETCORE_EVENT_RECYCLE_APP_FAILURE
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_RECYCLE_APP_FAILURE ((DWORD)0x000003FEL)
//
// MessageId: ASPNETCORE_EVENT_APP_IN_SHUTDOWN
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_APP_IN_SHUTDOWN ((DWORD)0x000003FFL)
//
// MessageId: ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_REMOVED
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_REMOVED ((DWORD)0x00000400L)
//
// MessageId: ASPNETCORE_EVENT_GENERAL_INFO_MSG
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_GENERAL_INFO_MSG ((DWORD)0x00000401L)
//
// MessageId: ASPNETCORE_EVENT_GENERAL_WARNING_MSG
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_GENERAL_WARNING_MSG ((DWORD)0x00000402L)
//
// MessageId: ASPNETCORE_EVENT_GENERAL_ERROR_MSG
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_GENERAL_ERROR_MSG ((DWORD)0x00000403L)
//
// MessageId: ASPNETCORE_EVENT_INPROCESS_RH_MISSING
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_INPROCESS_RH_MISSING ((DWORD)0x00000404L)
//
// MessageId: ASPNETCORE_EVENT_OUT_OF_PROCESS_RH_MISSING
//
// MessageText:
//
// %1
//
#define ASPNETCORE_EVENT_OUT_OF_PROCESS_RH_MISSING ((DWORD)0x00000405L)
#endif // _ASPNETCORE_MODULE_MSG_H_

View File

@ -0,0 +1,2 @@
LANGUAGE 0x9,0x1
1 11 "MSG00001.bin"

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#include "stdafx.h"
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#include "stdafx.h"

View File

@ -1,33 +1,34 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <Windows.h>
#include <httpserv.h>
#include <wchar.h>
#include <vector>
#include <shellapi.h>
#include <sstream>
#include "Shlwapi.h"
#include "..\IISLib\hashtable.h"
#include "..\IISLib\stringu.h"
#include "..\IISLib\stringa.h"
#include "..\IISLib\multisz.h"
#include "..\IISLib\dbgutil.h"
#include "..\IISLib\ahutil.h"
#include "..\IISLib\hashfn.h"
#include "environmentvariablehash.h"
#include "utility.h"
#include "aspnetcoreconfig.h"
#include "application.h"
#include "requesthandler.h"
#include "fx_ver.h"
#include "hostfxr_utility.h"
#include "resources.h"
#include "aspnetcore_msg.h"
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#pragma once
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <Windows.h>
#include <httpserv.h>
#include <wchar.h>
#include <vector>
#include <shellapi.h>
#include <sstream>
#include "Shlwapi.h"
#include "..\IISLib\hashtable.h"
#include "..\IISLib\stringu.h"
#include "..\IISLib\stringa.h"
#include "..\IISLib\multisz.h"
#include "..\IISLib\dbgutil.h"
#include "..\IISLib\ahutil.h"
#include "..\IISLib\hashfn.h"
#include "SRWLockWrapper.h"
#include "environmentvariablehash.h"
#include "utility.h"
#include "aspnetcoreconfig.h"
#include "application.h"
#include "requesthandler.h"
#include "fx_ver.h"
#include "hostfxr_utility.h"
#include "resources.h"
#include "aspnetcore_msg.h"

View File

@ -1,8 +1,8 @@
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
#include <SDKDDKVer.h>

View File

@ -0,0 +1,190 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{09D9D1D6-2951-4E14-BC35-76A23CF9391A}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>IISLib</RootNamespace>
<ProjectName>IISLib</ProjectName>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<ShowIncludes>false</ShowIncludes>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<ShowIncludes>false</ShowIncludes>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ShowIncludes>false</ShowIncludes>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ShowIncludes>false</ShowIncludes>
<TreatWarningAsError>true</TreatWarningAsError>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="acache.h" />
<ClInclude Include="ahutil.h" />
<ClInclude Include="base64.h" />
<ClInclude Include="buffer.h" />
<ClInclude Include="datetime.h" />
<ClInclude Include="dbgutil.h" />
<ClInclude Include="hashfn.h" />
<ClInclude Include="hashtable.h" />
<ClInclude Include="listentry.h" />
<ClInclude Include="macros.h" />
<ClInclude Include="multisz.h" />
<ClInclude Include="multisza.h" />
<ClInclude Include="ntassert.h" />
<ClInclude Include="percpu.h" />
<ClInclude Include="precomp.h" />
<ClInclude Include="prime.h" />
<ClInclude Include="pudebug.h" />
<ClInclude Include="reftrace.h" />
<ClInclude Include="rwlock.h" />
<ClInclude Include="stringa.h" />
<ClInclude Include="stringu.h" />
<ClInclude Include="tracelog.h" />
<ClInclude Include="treehash.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="acache.cxx" />
<ClCompile Include="ahutil.cpp" />
<ClCompile Include="base64.cpp" />
<ClCompile Include="multisz.cpp" />
<ClCompile Include="multisza.cpp" />
<ClCompile Include="reftrace.c" />
<ClCompile Include="stringa.cpp" />
<ClCompile Include="stringu.cpp" />
<ClCompile Include="tracelog.c" />
<ClCompile Include="util.cxx" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,443 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#include "precomp.h"
LONG ALLOC_CACHE_HANDLER::sm_nFillPattern = 0xACA50000;
HANDLE ALLOC_CACHE_HANDLER::sm_hHeap;
//
// This class is used to implement the free list. We cast the free'd
// memory block to a FREE_LIST_HEADER*. The signature is used to guard against
// double deletion. We also fill memory with a pattern.
//
class FREE_LIST_HEADER
{
public:
SLIST_ENTRY ListEntry;
DWORD dwSignature;
enum
{
FREE_SIGNATURE = (('A') | ('C' << 8) | ('a' << 16) | (('$' << 24) | 0x80)),
};
};
ALLOC_CACHE_HANDLER::ALLOC_CACHE_HANDLER(
VOID
) : m_nThreshold(0),
m_cbSize(0),
m_pFreeLists(NULL),
m_nTotal(0)
{
}
ALLOC_CACHE_HANDLER::~ALLOC_CACHE_HANDLER(
VOID
)
{
if (m_pFreeLists != NULL)
{
CleanupLookaside();
m_pFreeLists->Dispose();
m_pFreeLists = NULL;
}
}
HRESULT
ALLOC_CACHE_HANDLER::Initialize(
DWORD cbSize,
LONG nThreshold
)
{
HRESULT hr = S_OK;
m_nThreshold = nThreshold;
if ( m_nThreshold > 0xffff)
{
//
// This will be compared against QueryDepthSList return value (USHORT).
//
m_nThreshold = 0xffff;
}
if ( IsPageheapEnabled() )
{
//
// Disable acache.
//
m_nThreshold = 0;
}
//
// Make sure the block is big enough to hold a FREE_LIST_HEADER.
//
m_cbSize = cbSize;
m_cbSize = max(m_cbSize, sizeof(FREE_LIST_HEADER));
//
// Round up the block size to a multiple of the size of a LONG (for
// the fill pattern in Free()).
//
m_cbSize = (m_cbSize + sizeof(LONG) - 1) & ~(sizeof(LONG) - 1);
#if defined(_MSC_VER) && _MSC_VER >= 1600 // VC10
auto Init = [] (SLIST_HEADER* pHead)
{
InitializeSListHead(pHead);
};
#else
class Functor
{
public:
void operator()(SLIST_HEADER* pHead)
{
InitializeSListHead(pHead);
}
} Init;
#endif
hr = PER_CPU<SLIST_HEADER>::Create(Init,
&m_pFreeLists );
if (FAILED(hr))
{
goto Finished;
}
m_nFillPattern = InterlockedIncrement(&sm_nFillPattern);
Finished:
return hr;
}
// static
HRESULT
ALLOC_CACHE_HANDLER::StaticInitialize(
VOID
)
{
//
// Since the memory allocated is fixed size,
// a heap is not really needed, allocations can be done
// using VirtualAllocEx[Numa]. For now use Windows Heap.
//
// Be aware that creating one private heap consumes more
// virtual address space for the worker process.
//
sm_hHeap = GetProcessHeap();
return S_OK;
}
// static
VOID
ALLOC_CACHE_HANDLER::StaticTerminate(
VOID
)
{
sm_hHeap = NULL;
}
VOID
ALLOC_CACHE_HANDLER::CleanupLookaside(
VOID
)
/*++
Description:
This function cleans up the lookaside list by removing storage space.
Arguments:
None.
Returns:
None
--*/
{
//
// Free up all the entries in the list.
// Don't use InterlockedFlushSList, in order to work
// memory must be 16 bytes aligned and currently it is 64.
//
#if defined(_MSC_VER) && _MSC_VER >= 1600 // VC10
auto Predicate = [=] (SLIST_HEADER * pListHeader)
{
PSLIST_ENTRY pl;
LONG NodesToDelete = QueryDepthSList( pListHeader );
pl = InterlockedPopEntrySList( pListHeader );
while ( pl != NULL && --NodesToDelete >= 0 )
{
InterlockedDecrement( &m_nTotal);
::HeapFree( sm_hHeap, 0, pl );
pl = InterlockedPopEntrySList(pListHeader);
}
};
#else
class Functor
{
public:
explicit Functor(ALLOC_CACHE_HANDLER * pThis) : _pThis(pThis)
{
}
void operator()(SLIST_HEADER * pListHeader)
{
PSLIST_ENTRY pl;
LONG NodesToDelete = QueryDepthSList( pListHeader );
pl = InterlockedPopEntrySList( pListHeader );
while ( pl != NULL && --NodesToDelete >= 0 )
{
InterlockedDecrement( &_pThis->m_nTotal);
::HeapFree( sm_hHeap, 0, pl );
pl = InterlockedPopEntrySList(pListHeader);
}
}
private:
ALLOC_CACHE_HANDLER * _pThis;
} Predicate(this);
#endif
m_pFreeLists ->ForEach(Predicate);
}
LPVOID
ALLOC_CACHE_HANDLER::Alloc(
VOID
)
{
LPVOID pMemory = NULL;
if ( m_nThreshold > 0 )
{
SLIST_HEADER * pListHeader = m_pFreeLists ->GetLocal();
pMemory = (LPVOID) InterlockedPopEntrySList(pListHeader); // get the real object
if (pMemory != NULL)
{
FREE_LIST_HEADER* pfl = (FREE_LIST_HEADER*) pMemory;
//
// If the signature is wrong then somebody's been scribbling
// on memory that they've freed.
//
DBG_ASSERT(pfl->dwSignature == FREE_LIST_HEADER::FREE_SIGNATURE);
}
}
if ( pMemory == NULL )
{
//
// No free entry. Need to alloc a new object.
//
pMemory = (LPVOID) ::HeapAlloc( sm_hHeap,
0,
m_cbSize );
if ( pMemory != NULL )
{
//
// Update counters.
//
m_nTotal++;
}
}
if ( pMemory == NULL )
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
}
else
{
FREE_LIST_HEADER* pfl = (FREE_LIST_HEADER*) pMemory;
pfl->dwSignature = 0; // clear; just in case caller never overwrites
}
return pMemory;
}
VOID
ALLOC_CACHE_HANDLER::Free(
__in LPVOID pMemory
)
{
//
// Assume that this is allocated using the Alloc() function.
//
DBG_ASSERT(NULL != pMemory);
//
// Use a signature to check against double deletions.
//
FREE_LIST_HEADER* pfl = (FREE_LIST_HEADER*) pMemory;
DBG_ASSERT(pfl->dwSignature != FREE_LIST_HEADER::FREE_SIGNATURE);
//
// Start filling the space beyond the portion overlaid by the initial
// FREE_LIST_HEADER. Fill at most 6 DWORDS.
//
LONG* pl = (LONG*) (pfl+1);
for (LONG cb = (LONG)min(6 * sizeof(LONG),m_cbSize) - sizeof(FREE_LIST_HEADER);
cb > 0;
cb -= sizeof(LONG))
{
*pl++ = m_nFillPattern;
}
//
// Now, set the signature.
//
pfl->dwSignature = FREE_LIST_HEADER::FREE_SIGNATURE;
//
// Store the items in the alloc cache.
//
SLIST_HEADER * pListHeader = m_pFreeLists ->GetLocal();
if ( QueryDepthSList(pListHeader) >= m_nThreshold )
{
//
// Threshold for free entries is exceeded. Free the object to
// process pool.
//
::HeapFree( sm_hHeap, 0, pMemory );
}
else
{
//
// Store the given pointer in the single linear list
//
InterlockedPushEntrySList(pListHeader, &pfl->ListEntry);
}
}
DWORD
ALLOC_CACHE_HANDLER::QueryDepthForAllSLists(
VOID
)
/*++
Description:
Aggregates the total count of elements in all lists.
Arguments:
None.
Return Value:
Total count (snapshot).
--*/
{
DWORD Count = 0;
if (m_pFreeLists != NULL)
{
#if defined(_MSC_VER) && _MSC_VER >= 1600 // VC10
auto Predicate = [&Count] (SLIST_HEADER * pListHeader)
{
Count += QueryDepthSList(pListHeader);
};
#else
class Functor
{
public:
explicit Functor(DWORD& Count) : _Count(Count)
{
}
void operator()(SLIST_HEADER * pListHeader)
{
_Count += QueryDepthSList(pListHeader);
}
private:
DWORD& _Count;
} Predicate(Count);
#endif
//
// [&Count] means that the method can modify local variable Count.
//
m_pFreeLists ->ForEach(Predicate);
}
return Count;
}
// static
BOOL
ALLOC_CACHE_HANDLER::IsPageheapEnabled(
VOID
)
{
BOOL fRet = FALSE;
BOOL fLockedHeap = FALSE;
HMODULE hModule = NULL;
HANDLE hHeap = NULL;
PROCESS_HEAP_ENTRY heapEntry = {0};
//
// If verifier.dll is loaded - we are running under app verifier == pageheap is enabled
//
hModule = GetModuleHandle( L"verifier.dll" );
if ( hModule != NULL )
{
hModule = NULL;
fRet = TRUE;
goto Finished;
}
//
// Create a heap for calling heapwalk
// otherwise HeapWalk turns off lookasides for a useful heap
//
hHeap = ::HeapCreate( 0, 0, 0 );
if ( hHeap == NULL )
{
fRet = FALSE;
goto Finished;
}
fRet = ::HeapLock( hHeap );
if ( !fRet )
{
goto Finished;
}
fLockedHeap = TRUE;
//
// If HeapWalk is unsupported -> then running page heap
//
fRet = ::HeapWalk( hHeap, &heapEntry );
if ( !fRet )
{
if ( GetLastError() == ERROR_INVALID_FUNCTION )
{
fRet = TRUE;
goto Finished;
}
}
fRet = FALSE;
Finished:
if ( fLockedHeap )
{
fLockedHeap = FALSE;
DBG_REQUIRE( ::HeapUnlock( hHeap ) );
}
if ( hHeap )
{
DBG_REQUIRE( ::HeapDestroy( hHeap ) );
hHeap = NULL;
}
return fRet;
}

View File

@ -0,0 +1,115 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#pragma once
#include "percpu.h"
class ALLOC_CACHE_HANDLER
{
public:
ALLOC_CACHE_HANDLER(
VOID
);
~ALLOC_CACHE_HANDLER(
VOID
);
HRESULT
Initialize(
DWORD cbSize,
LONG nThreshold
);
LPVOID
Alloc(
VOID
);
VOID
Free(
__in LPVOID pMemory
);
private:
VOID
CleanupLookaside(
VOID
);
DWORD
QueryDepthForAllSLists(
VOID
);
LONG m_nThreshold;
DWORD m_cbSize;
PER_CPU<SLIST_HEADER> * m_pFreeLists;
//
// Total heap allocations done over the lifetime.
// Note that this is not interlocked, it is just a hint for debugging.
//
volatile LONG m_nTotal;
LONG m_nFillPattern;
public:
static
HRESULT
StaticInitialize(
VOID
);
static
VOID
StaticTerminate(
VOID
);
static
BOOL
IsPageheapEnabled();
private:
static LONG sm_nFillPattern;
static HANDLE sm_hHeap;
};
// You can use ALLOC_CACHE_HANDLER as a per-class allocator
// in your C++ classes. Add the following to your class definition:
//
// protected:
// static ALLOC_CACHE_HANDLER* sm_palloc;
// public:
// static void* operator new(size_t s)
// {
// IRTLASSERT(s == sizeof(C));
// IRTLASSERT(sm_palloc != NULL);
// return sm_palloc->Alloc();
// }
// static void operator delete(void* pv)
// {
// IRTLASSERT(pv != NULL);
// if (sm_palloc != NULL)
// sm_palloc->Free(pv);
// }
//
// Obviously, you must initialize sm_palloc before you can allocate
// any objects of this class.
//
// Note that if you derive a class from this base class, the derived class
// must also provide its own operator new and operator delete. If not, the
// base class's allocator will be called, but the size of the derived
// object will almost certainly be larger than that of the base object.
// Furthermore, the allocator will not be used for arrays of objects
// (override operator new[] and operator delete[]), but this is a
// harder problem since the allocator works with one fixed size.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,258 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#pragma once
#include<Windows.h>
HRESULT
SetElementProperty(
IN IAppHostElement * pElement,
IN CONST WCHAR * szPropName,
IN CONST VARIANT * varPropValue
);
HRESULT
SetElementStringProperty(
IN IAppHostElement * pElement,
IN CONST WCHAR * szPropName,
IN CONST WCHAR * szPropValue
);
HRESULT
GetElementStringProperty(
IN IAppHostElement * pElement,
IN CONST WCHAR * szPropName,
OUT BSTR * pbstrPropValue
);
HRESULT
GetElementStringProperty(
IN IAppHostElement * pElement,
IN CONST WCHAR * szPropName,
OUT STRU * pstrPropValue
);
HRESULT
GetElementBoolProperty(
IN IAppHostElement * pElement,
IN LPCWSTR pszPropertyName,
OUT BOOL * pBool
);
HRESULT
GetElementBoolProperty(
IN IAppHostElement * pElement,
IN LPCWSTR pszPropertyName,
OUT bool * pBool
);
HRESULT
GetElementChildByName(
IN IAppHostElement * pElement,
IN LPCWSTR pszElementName,
OUT IAppHostElement ** ppChildElement
);
HRESULT
GetElementDWORDProperty(
IN IAppHostElement * pElement,
IN LPCWSTR pszPropertyName,
OUT DWORD * pdwValue
);
HRESULT
GetElementLONGLONGProperty(
IN IAppHostElement * pElement,
IN LPCWSTR pszPropertyName,
OUT LONGLONG * pllValue
);
HRESULT
GetElementRawTimeSpanProperty(
IN IAppHostElement * pElement,
IN LPCWSTR pszPropertyName,
OUT ULONGLONG * pulonglong
);
#define FIND_ELEMENT_CASE_SENSITIVE 0x00000000
#define FIND_ELEMENT_CASE_INSENSITIVE 0x00000001
HRESULT
DeleteElementFromCollection(
IAppHostElementCollection *pCollection,
CONST WCHAR * szKeyName,
CONST WCHAR * szKeyValue,
ULONG BehaviorFlags,
BOOL * pfDeleted
);
HRESULT
DeleteAllElementsFromCollection(
IAppHostElementCollection *pCollection,
CONST WCHAR * szKeyName,
CONST WCHAR * szKeyValue,
ULONG BehaviorFlags,
UINT * pNumDeleted
);
HRESULT
FindElementInCollection(
IAppHostElementCollection *pCollection,
CONST WCHAR * szKeyName,
CONST WCHAR * szKeyValue,
ULONG BehaviorFlags,
OUT ULONG * pIndex
);
HRESULT
VariantAssign(
IN OUT VARIANT * pv,
IN CONST WCHAR * sz
);
HRESULT
GetLocationFromFile(
IN IAppHostAdminManager * pAdminMgr,
IN CONST WCHAR * szConfigPath,
IN CONST WCHAR * szLocationPath,
OUT IAppHostConfigLocation ** ppLocation,
OUT BOOL * pFound
);
HRESULT
GetSectionFromLocation(
IN IAppHostConfigLocation * pLocation,
IN CONST WCHAR * szSectionName,
OUT IAppHostElement ** ppSectionElement,
OUT BOOL * pFound
);
HRESULT
GetAdminElement(
IN IAppHostAdminManager * pAdminMgr,
IN CONST WCHAR * szConfigPath,
IN CONST WCHAR * szElementName,
OUT IAppHostElement ** pElement
);
HRESULT
ClearAdminElement(
IN IAppHostAdminManager * pAdminMgr,
IN CONST WCHAR * szConfigPath,
IN CONST WCHAR * szElementName
);
HRESULT
ClearElementFromAllSites(
IN IAppHostAdminManager * pAdminMgr,
IN CONST WCHAR * szConfigPath,
IN CONST WCHAR * szElementName
);
HRESULT
ClearElementFromAllLocations(
IN IAppHostAdminManager * pAdminMgr,
IN CONST WCHAR * szConfigPath,
IN CONST WCHAR * szElementName
);
HRESULT
ClearLocationElements(
IN IAppHostConfigLocation * pLocation,
IN CONST WCHAR * szElementName
);
HRESULT
CompareElementName(
IN IAppHostElement * pElement,
IN CONST WCHAR * szNameToMatch,
OUT BOOL * pMatched
);
HRESULT
ClearChildElementsByName(
IN IAppHostChildElementCollection * pCollection,
IN CONST WCHAR * szElementName,
OUT BOOL * pFound
);
HRESULT
GetSitesCollection(
IN IAppHostAdminManager * pAdminMgr,
IN CONST WCHAR * szConfigPath,
OUT IAppHostElementCollection ** pSitesCollection
);
HRESULT
GetLocationCollection(
IN IAppHostAdminManager * pAdminMgr,
IN CONST WCHAR * szConfigPath,
OUT IAppHostConfigLocationCollection ** pLocationCollection
);
struct ENUM_INDEX
{
VARIANT Index;
ULONG Count;
};
HRESULT
FindFirstElement(
IN IAppHostElementCollection * pCollection,
OUT ENUM_INDEX * pIndex,
OUT IAppHostElement ** pElement
);
HRESULT
FindNextElement(
IN IAppHostElementCollection * pCollection,
IN OUT ENUM_INDEX * pIndex,
OUT IAppHostElement ** pElement
);
HRESULT
FindFirstChildElement(
IN IAppHostChildElementCollection * pCollection,
OUT ENUM_INDEX * pIndex,
OUT IAppHostElement ** pElement
);
HRESULT
FindNextChildElement(
IN IAppHostChildElementCollection * pCollection,
IN OUT ENUM_INDEX * pIndex,
OUT IAppHostElement ** pElement
);
HRESULT
FindFirstLocation(
IN IAppHostConfigLocationCollection * pCollection,
OUT ENUM_INDEX * pIndex,
OUT IAppHostConfigLocation ** pLocation
);
HRESULT
FindNextLocation(
IN IAppHostConfigLocationCollection * pCollection,
IN OUT ENUM_INDEX * pIndex,
OUT IAppHostConfigLocation ** pLocation
);
HRESULT
FindFirstLocationElement(
IN IAppHostConfigLocation * pLocation,
OUT ENUM_INDEX * pIndex,
OUT IAppHostElement ** pElement
);
HRESULT
FindNextLocationElement(
IN IAppHostConfigLocation * pLocation,
IN OUT ENUM_INDEX * pIndex,
OUT IAppHostElement ** pElement
);
HRESULT GetSharedConfigEnabled(
BOOL * pfIsSharedConfig
);

View File

@ -0,0 +1,482 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
#include "precomp.h"
DWORD
Base64Encode(
__in_bcount(cbDecodedBufferSize) VOID * pDecodedBuffer,
IN DWORD cbDecodedBufferSize,
__out_ecount_opt(cchEncodedStringSize) PWSTR pszEncodedString,
IN DWORD cchEncodedStringSize,
__out_opt DWORD * pcchEncoded
)
/*++
Routine Description:
Decode a base64-encoded string.
Arguments:
pDecodedBuffer (IN) - buffer to encode.
cbDecodedBufferSize (IN) - size of buffer to encode.
cchEncodedStringSize (IN) - size of the buffer for the encoded string.
pszEncodedString (OUT) = the encoded string.
pcchEncoded (OUT) - size in characters of the encoded string.
Return Values:
0 - success.
E_OUTOFMEMORY
--*/
{
static WCHAR rgchEncodeTable[64] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'
};
DWORD ib;
DWORD ich;
DWORD cchEncoded;
BYTE b0, b1, b2;
BYTE * pbDecodedBuffer = (BYTE *) pDecodedBuffer;
// Calculate encoded string size.
cchEncoded = 1 + (cbDecodedBufferSize + 2) / 3 * 4;
if (NULL != pcchEncoded) {
*pcchEncoded = cchEncoded;
}
if (cchEncodedStringSize == 0 && pszEncodedString == NULL) {
return ERROR_SUCCESS;
}
if (cchEncodedStringSize < cchEncoded) {
// Given buffer is too small to hold encoded string.
return ERROR_INSUFFICIENT_BUFFER;
}
// Encode data byte triplets into four-byte clusters.
ib = ich = 0;
while (ib < cbDecodedBufferSize) {
b0 = pbDecodedBuffer[ib++];
b1 = (ib < cbDecodedBufferSize) ? pbDecodedBuffer[ib++] : 0;
b2 = (ib < cbDecodedBufferSize) ? pbDecodedBuffer[ib++] : 0;
//
// The checks below for buffer overflow seems redundant to me.
// But it's the only way I can find to keep OACR quiet so it
// will have to do.
//
pszEncodedString[ich++] = rgchEncodeTable[b0 >> 2];
if ( ich >= cchEncodedStringSize )
{
DBG_ASSERT( FALSE );
return ERROR_BUFFER_OVERFLOW;
}
pszEncodedString[ich++] = rgchEncodeTable[((b0 << 4) & 0x30) | ((b1 >> 4) & 0x0f)];
if ( ich >= cchEncodedStringSize )
{
DBG_ASSERT( FALSE );
return ERROR_BUFFER_OVERFLOW;
}
pszEncodedString[ich++] = rgchEncodeTable[((b1 << 2) & 0x3c) | ((b2 >> 6) & 0x03)];
if ( ich >= cchEncodedStringSize )
{
DBG_ASSERT( FALSE );
return ERROR_BUFFER_OVERFLOW;
}
pszEncodedString[ich++] = rgchEncodeTable[b2 & 0x3f];
if ( ich >= cchEncodedStringSize )
{
DBG_ASSERT( FALSE );
return ERROR_BUFFER_OVERFLOW;
}
}
// Pad the last cluster as necessary to indicate the number of data bytes
// it represents.
switch (cbDecodedBufferSize % 3) {
case 0:
break;
case 1:
pszEncodedString[ich - 2] = '=';
__fallthrough;
case 2:
pszEncodedString[ich - 1] = '=';
break;
}
// Null-terminate the encoded string.
pszEncodedString[ich++] = '\0';
DBG_ASSERT(ich == cchEncoded);
return ERROR_SUCCESS;
}
DWORD
Base64Decode(
__in PCWSTR pszEncodedString,
__out_opt VOID * pDecodeBuffer,
__in DWORD cbDecodeBufferSize,
__out_opt DWORD * pcbDecoded
)
/*++
Routine Description:
Decode a base64-encoded string.
Arguments:
pszEncodedString (IN) - base64-encoded string to decode.
cbDecodeBufferSize (IN) - size in bytes of the decode buffer.
pbDecodeBuffer (OUT) - holds the decoded data.
pcbDecoded (OUT) - number of data bytes in the decoded data (if success or
STATUS_BUFFER_TOO_SMALL).
Return Values:
0 - success.
E_OUTOFMEMORY
E_INVALIDARG
--*/
{
#define NA (255)
#define DECODE(x) (((ULONG)(x) < sizeof(rgbDecodeTable)) ? rgbDecodeTable[x] : NA)
static BYTE rgbDecodeTable[128] = {
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, // 0-15
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, // 16-31
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 62, NA, NA, NA, 63, // 32-47
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, NA, NA, NA, 0, NA, NA, // 48-63
NA, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 64-79
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, NA, NA, NA, NA, NA, // 80-95
NA, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 96-111
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, NA, NA, NA, NA, NA, // 112-127
};
DWORD cbDecoded;
DWORD cchEncodedSize;
DWORD ich;
DWORD ib;
BYTE b0, b1, b2, b3;
BYTE * pbDecodeBuffer = (BYTE *) pDecodeBuffer;
cchEncodedSize = (DWORD)wcslen(pszEncodedString);
if (NULL != pcbDecoded) {
*pcbDecoded = 0;
}
if ((0 == cchEncodedSize) || (0 != (cchEncodedSize % 4))) {
// Input string is not sized correctly to be base64.
return ERROR_INVALID_PARAMETER;
}
// Calculate decoded buffer size.
cbDecoded = (cchEncodedSize + 3) / 4 * 3;
if (pszEncodedString[cchEncodedSize-1] == '=') {
if (pszEncodedString[cchEncodedSize-2] == '=') {
// Only one data byte is encoded in the last cluster.
cbDecoded -= 2;
}
else {
// Only two data bytes are encoded in the last cluster.
cbDecoded -= 1;
}
}
if (NULL != pcbDecoded) {
*pcbDecoded = cbDecoded;
}
if (cbDecodeBufferSize == 0 && pDecodeBuffer == NULL) {
return ERROR_SUCCESS;
}
if (cbDecoded > cbDecodeBufferSize) {
// Supplied buffer is too small.
return ERROR_INSUFFICIENT_BUFFER;
}
// Decode each four-byte cluster into the corresponding three data bytes.
ich = ib = 0;
while (ich < cchEncodedSize) {
b0 = DECODE(pszEncodedString[ich]); ich++;
b1 = DECODE(pszEncodedString[ich]); ich++;
b2 = DECODE(pszEncodedString[ich]); ich++;
b3 = DECODE(pszEncodedString[ich]); ich++;
if ((NA == b0) || (NA == b1) || (NA == b2) || (NA == b3)) {
// Contents of input string are not base64.
return ERROR_INVALID_PARAMETER;
}
pbDecodeBuffer[ib++] = (b0 << 2) | (b1 >> 4);
if (ib < cbDecoded) {
pbDecodeBuffer[ib++] = (b1 << 4) | (b2 >> 2);
if (ib < cbDecoded) {
pbDecodeBuffer[ib++] = (b2 << 6) | b3;
}
}
}
DBG_ASSERT(ib == cbDecoded);
return ERROR_SUCCESS;
}
DWORD
Base64Encode(
__in_bcount(cbDecodedBufferSize) VOID * pDecodedBuffer,
IN DWORD cbDecodedBufferSize,
__out_ecount_opt(cchEncodedStringSize) PSTR pszEncodedString,
IN DWORD cchEncodedStringSize,
__out_opt DWORD * pcchEncoded
)
/*++
Routine Description:
Decode a base64-encoded string.
Arguments:
pDecodedBuffer (IN) - buffer to encode.
cbDecodedBufferSize (IN) - size of buffer to encode.
cchEncodedStringSize (IN) - size of the buffer for the encoded string.
pszEncodedString (OUT) = the encoded string.
pcchEncoded (OUT) - size in characters of the encoded string.
Return Values:
0 - success.
E_OUTOFMEMORY
--*/
{
static CHAR rgchEncodeTable[64] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'
};
DWORD ib;
DWORD ich;
DWORD cchEncoded;
BYTE b0, b1, b2;
BYTE * pbDecodedBuffer = (BYTE *) pDecodedBuffer;
// Calculate encoded string size.
cchEncoded = 1 + (cbDecodedBufferSize + 2) / 3 * 4;
if (NULL != pcchEncoded) {
*pcchEncoded = cchEncoded;
}
if (cchEncodedStringSize == 0 && pszEncodedString == NULL) {
return ERROR_SUCCESS;
}
if (cchEncodedStringSize < cchEncoded) {
// Given buffer is too small to hold encoded string.
return ERROR_INSUFFICIENT_BUFFER;
}
// Encode data byte triplets into four-byte clusters.
ib = ich = 0;
while (ib < cbDecodedBufferSize) {
b0 = pbDecodedBuffer[ib++];
b1 = (ib < cbDecodedBufferSize) ? pbDecodedBuffer[ib++] : 0;
b2 = (ib < cbDecodedBufferSize) ? pbDecodedBuffer[ib++] : 0;
//
// The checks below for buffer overflow seems redundant to me.
// But it's the only way I can find to keep OACR quiet so it
// will have to do.
//
pszEncodedString[ich++] = rgchEncodeTable[b0 >> 2];
if ( ich >= cchEncodedStringSize )
{
DBG_ASSERT( FALSE );
return ERROR_BUFFER_OVERFLOW;
}
pszEncodedString[ich++] = rgchEncodeTable[((b0 << 4) & 0x30) | ((b1 >> 4) & 0x0f)];
if ( ich >= cchEncodedStringSize )
{
DBG_ASSERT( FALSE );
return ERROR_BUFFER_OVERFLOW;
}
pszEncodedString[ich++] = rgchEncodeTable[((b1 << 2) & 0x3c) | ((b2 >> 6) & 0x03)];
if ( ich >= cchEncodedStringSize )
{
DBG_ASSERT( FALSE );
return ERROR_BUFFER_OVERFLOW;
}
pszEncodedString[ich++] = rgchEncodeTable[b2 & 0x3f];
if ( ich >= cchEncodedStringSize )
{
DBG_ASSERT( FALSE );
return ERROR_BUFFER_OVERFLOW;
}
}
// Pad the last cluster as necessary to indicate the number of data bytes
// it represents.
switch (cbDecodedBufferSize % 3) {
case 0:
break;
case 1:
pszEncodedString[ich - 2] = '=';
__fallthrough;
case 2:
pszEncodedString[ich - 1] = '=';
break;
}
// Null-terminate the encoded string.
pszEncodedString[ich++] = '\0';
DBG_ASSERT(ich == cchEncoded);
return ERROR_SUCCESS;
}
DWORD
Base64Decode(
__in PCSTR pszEncodedString,
__out_opt VOID * pDecodeBuffer,
__in DWORD cbDecodeBufferSize,
__out_opt DWORD * pcbDecoded
)
/*++
Routine Description:
Decode a base64-encoded string.
Arguments:
pszEncodedString (IN) - base64-encoded string to decode.
cbDecodeBufferSize (IN) - size in bytes of the decode buffer.
pbDecodeBuffer (OUT) - holds the decoded data.
pcbDecoded (OUT) - number of data bytes in the decoded data (if success or
STATUS_BUFFER_TOO_SMALL).
Return Values:
0 - success.
E_OUTOFMEMORY
E_INVALIDARG
--*/
{
#define NA (255)
#define DECODE(x) (((ULONG)(x) < sizeof(rgbDecodeTable)) ? rgbDecodeTable[x] : NA)
static BYTE rgbDecodeTable[128] = {
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, // 0-15
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, // 16-31
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 62, NA, NA, NA, 63, // 32-47
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, NA, NA, NA, 0, NA, NA, // 48-63
NA, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 64-79
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, NA, NA, NA, NA, NA, // 80-95
NA, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 96-111
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, NA, NA, NA, NA, NA, // 112-127
};
DWORD cbDecoded;
DWORD cchEncodedSize;
DWORD ich;
DWORD ib;
BYTE b0, b1, b2, b3;
BYTE * pbDecodeBuffer = (BYTE *) pDecodeBuffer;
cchEncodedSize = (DWORD)strlen(pszEncodedString);
if (NULL != pcbDecoded) {
*pcbDecoded = 0;
}
if ((0 == cchEncodedSize) || (0 != (cchEncodedSize % 4))) {
// Input string is not sized correctly to be base64.
return ERROR_INVALID_PARAMETER;
}
// Calculate decoded buffer size.
cbDecoded = (cchEncodedSize + 3) / 4 * 3;
if (pszEncodedString[cchEncodedSize-1] == '=') {
if (pszEncodedString[cchEncodedSize-2] == '=') {
// Only one data byte is encoded in the last cluster.
cbDecoded -= 2;
}
else {
// Only two data bytes are encoded in the last cluster.
cbDecoded -= 1;
}
}
if (NULL != pcbDecoded) {
*pcbDecoded = cbDecoded;
}
if (cbDecodeBufferSize == 0 && pDecodeBuffer == NULL) {
return ERROR_SUCCESS;
}
if (cbDecoded > cbDecodeBufferSize) {
// Supplied buffer is too small.
return ERROR_INSUFFICIENT_BUFFER;
}
// Decode each four-byte cluster into the corresponding three data bytes.
ich = ib = 0;
while (ich < cchEncodedSize) {
b0 = DECODE(pszEncodedString[ich]); ich++;
b1 = DECODE(pszEncodedString[ich]); ich++;
b2 = DECODE(pszEncodedString[ich]); ich++;
b3 = DECODE(pszEncodedString[ich]); ich++;
if ((NA == b0) || (NA == b1) || (NA == b2) || (NA == b3)) {
// Contents of input string are not base64.
return ERROR_INVALID_PARAMETER;
}
pbDecodeBuffer[ib++] = (b0 << 2) | (b1 >> 4);
if (ib < cbDecoded) {
pbDecodeBuffer[ib++] = (b1 << 4) | (b2 >> 2);
if (ib < cbDecoded) {
pbDecodeBuffer[ib++] = (b2 << 6) | b3;
}
}
}
DBG_ASSERT(ib == cbDecoded);
return ERROR_SUCCESS;
}

Some files were not shown because too many files have changed in this diff Show More