Add Hostable Web Core based inprocess test server (#853)
This commit is contained in:
parent
23cb0c90b2
commit
1e143c71c6
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Using shorter assembly name instead of Microsoft.AspNetCore.Server.Kestrel.Performance because https://github.com/dotnet/BenchmarkDotNet/issues/498 -->
|
||||
|
|
@ -15,13 +15,21 @@
|
|||
<Content Include="..\..\test\IISIntegration.FunctionalTests\AppHostConfig\*.config" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\bin\$(Configuration)\x64\aspnetcorev2_inprocess.dll" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="%(FileName)%(Extension)" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\bin\$(Configuration)\x64\aspnetcorev2_inprocess.pdb" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="%(FileName)%(Extension)" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\x64\aspnetcorev2.dll" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="%(FileName)%(Extension)" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\x64\aspnetcorev2.pdb" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="%(FileName)%(Extension)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Server.IISIntegration\Microsoft.AspNetCore.Server.IISIntegration.csproj" />
|
||||
<ProjectReference Include="..\..\test\IISIntegration.FunctionalTests\IISIntegration.FunctionalTests.csproj" />
|
||||
<ProjectReference Include="..\..\test\WebSites\**\*.csproj">
|
||||
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BenchmarkDotNet" Version="$(BenchmarkDotNetPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.BenchmarkRunner.Sources" PrivateAssets="All" Version="$(MicrosoftAspNetCoreBenchmarkRunnerSourcesPackageVersion)" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using IISIntegration.FunctionalTests.Utilities;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.IIS.Performance
|
||||
{
|
||||
[AspNetCoreBenchmark]
|
||||
public class PlaintextBenchmark
|
||||
{
|
||||
private TestServer _server;
|
||||
|
||||
private HttpClient _client;
|
||||
|
||||
[GlobalSetup]
|
||||
public void Setup()
|
||||
{
|
||||
_server = TestServer.Create(builder => builder.UseMiddleware<PlaintextMiddleware>(), new LoggerFactory()).GetAwaiter().GetResult();
|
||||
// Recreate client, TestServer.Client has additional logging that can hurt performance
|
||||
_client = new HttpClient()
|
||||
{
|
||||
BaseAddress = _server.HttpClient.BaseAddress
|
||||
};
|
||||
}
|
||||
|
||||
[Benchmark]
|
||||
public async Task Plaintext()
|
||||
{
|
||||
await _client.GetAsync("/plaintext");
|
||||
}
|
||||
|
||||
// Copied from https://github.com/aspnet/benchmarks/blob/dev/src/Benchmarks/Middleware/PlaintextMiddleware.cs
|
||||
public class PlaintextMiddleware
|
||||
{
|
||||
private static readonly PathString _path = new PathString("/plaintext");
|
||||
private static readonly byte[] _helloWorldPayload = Encoding.UTF8.GetBytes("Hello, World!");
|
||||
|
||||
private readonly RequestDelegate _next;
|
||||
|
||||
public PlaintextMiddleware(RequestDelegate next)
|
||||
{
|
||||
_next = next;
|
||||
}
|
||||
|
||||
public Task Invoke(HttpContext httpContext)
|
||||
{
|
||||
if (httpContext.Request.Path.StartsWithSegments(_path, StringComparison.Ordinal))
|
||||
{
|
||||
return WriteResponse(httpContext.Response);
|
||||
}
|
||||
|
||||
return _next(httpContext);
|
||||
}
|
||||
|
||||
public static Task WriteResponse(HttpResponse response)
|
||||
{
|
||||
var payloadLength = _helloWorldPayload.Length;
|
||||
response.StatusCode = 200;
|
||||
response.ContentType = "text/plain";
|
||||
response.ContentLength = payloadLength;
|
||||
return response.Body.WriteAsync(_helloWorldPayload, 0, payloadLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,6 @@ using System.IO;
|
|||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Running;
|
||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||
using Microsoft.AspNetCore.Testing;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
|
|
|
|||
|
|
@ -1,262 +1,262 @@
|
|||
<?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>{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>AspNetCoreModule</RootNamespace>
|
||||
<ProjectName>AspNetCore</ProjectName>
|
||||
<TargetName>aspnetcorev2</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;..\CommonLib</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;..\CommonLib</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;..\CommonLib</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;..\CommonLib</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>
|
||||
<ClInclude Include="Inc\applicationinfo.h" />
|
||||
<ClInclude Include="Inc\appoffline.h" />
|
||||
<ClInclude Include="Inc\aspnetcore_shim_config.h" />
|
||||
<ClInclude Include="inc\globalmodule.h" />
|
||||
<ClInclude Include="Inc\applicationmanager.h" />
|
||||
<ClInclude Include="Inc\filewatcher.h" />
|
||||
<ClInclude Include="Inc\proxymodule.h" />
|
||||
<ClInclude Include="Src\precomp.hxx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Src\applicationinfo.cpp" />
|
||||
<ClCompile Include="Src\applicationmanager.cxx" />
|
||||
<ClCompile Include="src\aspnetcore_shim_config.cpp" />
|
||||
<ClCompile Include="Src\dllmain.cpp" />
|
||||
<ClCompile Include="Src\filewatcher.cxx" />
|
||||
<ClCompile Include="src\globalmodule.cpp" />
|
||||
<ClCompile Include="Src\proxymodule.cxx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CommonLib\CommonLib.vcxproj">
|
||||
<Project>{55494e58-e061-4c4c-a0a8-837008e72f85}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\IISLib\IISLib.vcxproj">
|
||||
<Project>{09d9d1d6-2951-4e14-bc35-76a23cf9391a}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ancm.mof" />
|
||||
<None Include="Source.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="aspnetcoremodule.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="aspnetcore_schema_v2.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="ancm.mof">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Xml Include="aspnetcore_schema_v2.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\..\build\native.targets" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<?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>{EC82302F-D2F0-4727-99D1-EABC0DD9DC3B}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>AspNetCoreModule</RootNamespace>
|
||||
<ProjectName>AspNetCore</ProjectName>
|
||||
<TargetName>aspnetcorev2</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;..\CommonLib</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;..\CommonLib</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;..\CommonLib</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;..\CommonLib</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>
|
||||
<ClInclude Include="Inc\applicationinfo.h" />
|
||||
<ClInclude Include="Inc\appoffline.h" />
|
||||
<ClInclude Include="Inc\aspnetcore_shim_config.h" />
|
||||
<ClInclude Include="inc\globalmodule.h" />
|
||||
<ClInclude Include="Inc\applicationmanager.h" />
|
||||
<ClInclude Include="Inc\filewatcher.h" />
|
||||
<ClInclude Include="Inc\proxymodule.h" />
|
||||
<ClInclude Include="Src\precomp.hxx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Src\applicationinfo.cpp" />
|
||||
<ClCompile Include="Src\applicationmanager.cxx" />
|
||||
<ClCompile Include="src\aspnetcore_shim_config.cpp" />
|
||||
<ClCompile Include="Src\dllmain.cpp" />
|
||||
<ClCompile Include="Src\filewatcher.cxx" />
|
||||
<ClCompile Include="src\globalmodule.cpp" />
|
||||
<ClCompile Include="Src\proxymodule.cxx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CommonLib\CommonLib.vcxproj">
|
||||
<Project>{55494e58-e061-4c4c-a0a8-837008e72f85}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\IISLib\IISLib.vcxproj">
|
||||
<Project>{09d9d1d6-2951-4e14-bc35-76a23cf9391a}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ancm.mof" />
|
||||
<None Include="Source.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="aspnetcoremodule.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="aspnetcore_schema_v2.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="ancm.mof">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Xml Include="aspnetcore_schema_v2.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\..\..\build\native.targets" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
#pragma once
|
||||
|
||||
#define API_BUFFER_TOO_SMALL 0x80008098
|
||||
|
||||
extern BOOL g_fRecycleProcessCalled;
|
||||
|
|
@ -147,14 +148,13 @@ public:
|
|||
|
||||
HRESULT
|
||||
EnsureApplicationCreated(
|
||||
IHttpContext *pHttpContext,
|
||||
STRU* exeLocation
|
||||
IHttpContext *pHttpContext
|
||||
);
|
||||
|
||||
private:
|
||||
HRESULT FindRequestHandlerAssembly();
|
||||
HRESULT FindNativeAssemblyFromGlobalLocation(STRU* struFilename);
|
||||
HRESULT FindNativeAssemblyFromHostfxr(STRU* struFilename);
|
||||
HRESULT FindRequestHandlerAssembly(STRU& location);
|
||||
HRESULT FindNativeAssemblyFromGlobalLocation(PCWSTR libraryName, STRU* location);
|
||||
HRESULT FindNativeAssemblyFromHostfxr(HOSTFXR_OPTIONS* hostfxrOptions, PCWSTR libraryName, STRU* location);
|
||||
|
||||
static VOID DoRecycleApplication(LPVOID lpParam);
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@ public:
|
|||
_In_ IHttpServer *pHttpServer,
|
||||
_In_ HTTP_MODULE_ID pModuleId,
|
||||
_In_ IHttpApplication *pHttpApplication,
|
||||
_In_ HANDLE hEventLog,
|
||||
_Out_ STRU *pcwzExePath,
|
||||
_Out_ ASPNETCORE_SHIM_CONFIG **ppAspNetCoreConfig
|
||||
);
|
||||
|
||||
|
|
@ -72,24 +70,6 @@ public:
|
|||
return &m_struApplication;
|
||||
}
|
||||
|
||||
CONST
|
||||
PCWSTR*
|
||||
QueryHostFxrArguments(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return m_ppStrArguments;
|
||||
}
|
||||
|
||||
CONST
|
||||
DWORD
|
||||
QueryHostFxrArgCount(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return m_dwArgc;
|
||||
}
|
||||
|
||||
STRU*
|
||||
QueryConfigPath(
|
||||
VOID
|
||||
|
|
@ -114,14 +94,6 @@ public:
|
|||
return &m_struArguments;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
SetHostFxrFullPath(
|
||||
PCWSTR pStrHostFxrFullPath
|
||||
)
|
||||
{
|
||||
return m_struHostFxrLocation.Copy(pStrHostFxrFullPath);
|
||||
}
|
||||
|
||||
APP_HOSTING_MODEL
|
||||
QueryHostingModel(
|
||||
VOID
|
||||
|
|
@ -130,35 +102,10 @@ public:
|
|||
return m_hostingModel;
|
||||
}
|
||||
|
||||
CONST
|
||||
PCWSTR
|
||||
QueryHostFxrFullPath(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return m_struHostFxrLocation.QueryStr();
|
||||
}
|
||||
|
||||
VOID
|
||||
SetHostFxrArguments(
|
||||
DWORD dwArgc,
|
||||
PWSTR* ppStrArguments
|
||||
)
|
||||
{
|
||||
if (m_ppStrArguments != NULL)
|
||||
{
|
||||
delete[] m_ppStrArguments;
|
||||
}
|
||||
|
||||
m_dwArgc = dwArgc;
|
||||
m_ppStrArguments = ppStrArguments;
|
||||
}
|
||||
|
||||
private:
|
||||
ASPNETCORE_SHIM_CONFIG() :
|
||||
m_cRefs(1),
|
||||
m_hostingModel(HOSTING_UNKNOWN),
|
||||
m_ppStrArguments(NULL)
|
||||
m_hostingModel(HOSTING_UNKNOWN)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -170,7 +117,5 @@ private:
|
|||
STRU m_struConfigPath;
|
||||
APP_HOSTING_MODEL m_hostingModel;
|
||||
STRU m_struHostFxrLocation;
|
||||
PWSTR* m_ppStrArguments;
|
||||
DWORD m_dwArgc;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -106,22 +106,16 @@ APPLICATION_INFO::UpdateAppOfflineFileHandle()
|
|||
|
||||
ReferenceApplicationInfo();
|
||||
|
||||
if (INVALID_FILE_ATTRIBUTES == GetFileAttributes(strFilePath.QueryStr()) &&
|
||||
GetLastError() == ERROR_FILE_NOT_FOUND)
|
||||
if (INVALID_FILE_ATTRIBUTES == GetFileAttributes(strFilePath.QueryStr()))
|
||||
{
|
||||
// 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());
|
||||
}
|
||||
UTILITY::LogEvent(g_hEventLog,
|
||||
EVENTLOG_INFORMATION_TYPE,
|
||||
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_REMOVED,
|
||||
ASPNETCORE_EVENT_RECYCLE_APPOFFLINE_REMOVED_MSG);
|
||||
}
|
||||
|
||||
m_fAppOfflineFound = FALSE;
|
||||
|
|
@ -178,13 +172,13 @@ APPLICATION_INFO::UpdateAppOfflineFileHandle()
|
|||
|
||||
HRESULT
|
||||
APPLICATION_INFO::EnsureApplicationCreated(
|
||||
IHttpContext *pHttpContext,
|
||||
STRU* struExeLocation
|
||||
IHttpContext *pHttpContext
|
||||
)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
BOOL fLocked = FALSE;
|
||||
IAPPLICATION *pApplication = NULL;
|
||||
STRU struExeLocation;
|
||||
STACK_STRU(struFileName, 300); // >MAX_PATH
|
||||
STRU struHostFxrDllLocation;
|
||||
|
||||
|
|
@ -213,7 +207,7 @@ APPLICATION_INFO::EnsureApplicationCreated(
|
|||
// FindRequestHandlerAssembly obtains a global lock, but after releasing the lock,
|
||||
// there is a period where we could call
|
||||
|
||||
hr = FindRequestHandlerAssembly();
|
||||
hr = FindRequestHandlerAssembly(struExeLocation);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
goto Finished;
|
||||
|
|
@ -225,13 +219,14 @@ APPLICATION_INFO::EnsureApplicationCreated(
|
|||
goto Finished;
|
||||
}
|
||||
|
||||
hr = m_pfnAspNetCoreCreateApplication(m_pServer, pHttpContext, struExeLocation->QueryStr(), &pApplication);
|
||||
hr = m_pfnAspNetCoreCreateApplication(m_pServer, pHttpContext, struExeLocation.QueryStr(), &pApplication);
|
||||
|
||||
m_pApplication = pApplication;
|
||||
}
|
||||
}
|
||||
|
||||
Finished:
|
||||
|
||||
if (fLocked)
|
||||
{
|
||||
ReleaseSRWLockExclusive(&m_srwLock);
|
||||
|
|
@ -240,10 +235,11 @@ Finished:
|
|||
}
|
||||
|
||||
HRESULT
|
||||
APPLICATION_INFO::FindRequestHandlerAssembly()
|
||||
APPLICATION_INFO::FindRequestHandlerAssembly(STRU& location)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
BOOL fLocked = FALSE;
|
||||
PCWSTR pstrHandlerDllName;
|
||||
STACK_STRU(struFileName, 256);
|
||||
|
||||
if (g_fAspnetcoreRHLoadedError)
|
||||
|
|
@ -267,46 +263,67 @@ APPLICATION_INFO::FindRequestHandlerAssembly()
|
|||
|
||||
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;
|
||||
}
|
||||
pstrHandlerDllName = g_pwzAspnetcoreInProcessRequestHandlerName;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FAILED(hr = FindNativeAssemblyFromGlobalLocation(&struFileName)))
|
||||
pstrHandlerDllName = g_pwzAspnetcoreOutOfProcessRequestHandlerName;
|
||||
}
|
||||
|
||||
// Try to see if RH is already loaded
|
||||
g_hAspnetCoreRH = GetModuleHandle(pstrHandlerDllName);
|
||||
|
||||
if (g_hAspnetCoreRH == NULL)
|
||||
{
|
||||
if (m_pConfiguration->QueryHostingModel() == APP_HOSTING_MODEL::HOSTING_IN_PROCESS)
|
||||
{
|
||||
STACK_STRU(strEventMsg, 256);
|
||||
if (SUCCEEDED(strEventMsg.SafeSnwprintf(
|
||||
ASPNETCORE_EVENT_OUT_OF_PROCESS_RH_MISSING_MSG)))
|
||||
std:: unique_ptr<HOSTFXR_OPTIONS> options;
|
||||
|
||||
if (FAILED(hr = HOSTFXR_OPTIONS::Create(
|
||||
NULL,
|
||||
m_pConfiguration->QueryProcessPath()->QueryStr(),
|
||||
m_pConfiguration->QueryApplicationPhysicalPath()->QueryStr(),
|
||||
m_pConfiguration->QueryArguments()->QueryStr(),
|
||||
g_hEventLog,
|
||||
options)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
location.Copy(options->GetExeLocation());
|
||||
|
||||
if (FAILED(hr = FindNativeAssemblyFromHostfxr(options.get(), pstrHandlerDllName, &struFileName)))
|
||||
{
|
||||
UTILITY::LogEvent(g_hEventLog,
|
||||
EVENTLOG_INFORMATION_TYPE,
|
||||
ASPNETCORE_EVENT_INPROCESS_RH_MISSING,
|
||||
ASPNETCORE_EVENT_INPROCESS_RH_MISSING_MSG);
|
||||
|
||||
goto Finished;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FAILED(hr = FindNativeAssemblyFromGlobalLocation(pstrHandlerDllName, &struFileName)))
|
||||
{
|
||||
UTILITY::LogEvent(g_hEventLog,
|
||||
EVENTLOG_INFORMATION_TYPE,
|
||||
ASPNETCORE_EVENT_OUT_OF_PROCESS_RH_MISSING,
|
||||
strEventMsg.QueryStr());
|
||||
}
|
||||
ASPNETCORE_EVENT_OUT_OF_PROCESS_RH_MISSING_MSG);
|
||||
|
||||
goto Finished;
|
||||
}
|
||||
}
|
||||
|
||||
g_hAspnetCoreRH = LoadLibraryW(struFileName.QueryStr());
|
||||
|
||||
if (g_hAspnetCoreRH == NULL)
|
||||
{
|
||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
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)
|
||||
|
|
@ -338,7 +355,9 @@ Finished:
|
|||
}
|
||||
|
||||
HRESULT
|
||||
APPLICATION_INFO::FindNativeAssemblyFromGlobalLocation(STRU* struFilename)
|
||||
APPLICATION_INFO::FindNativeAssemblyFromGlobalLocation(
|
||||
PCWSTR libraryName,
|
||||
STRU* struFilename)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
DWORD dwSize = MAX_PATH;
|
||||
|
|
@ -385,7 +404,7 @@ APPLICATION_INFO::FindNativeAssemblyFromGlobalLocation(STRU* struFilename)
|
|||
|
||||
if (FAILED(hr = struFilename->SyncWithBuffer()) ||
|
||||
FAILED(hr = struFilename->Append(L"\\")) ||
|
||||
FAILED(hr = struFilename->Append(g_pwzAspnetcoreOutOfProcessRequestHandlerName)))
|
||||
FAILED(hr = struFilename->Append(libraryName)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
|
@ -401,6 +420,8 @@ Finished:
|
|||
//
|
||||
HRESULT
|
||||
APPLICATION_INFO::FindNativeAssemblyFromHostfxr(
|
||||
HOSTFXR_OPTIONS* hostfxrOptions,
|
||||
PCWSTR libraryName,
|
||||
STRU* struFilename
|
||||
)
|
||||
{
|
||||
|
|
@ -418,7 +439,7 @@ APPLICATION_INFO::FindNativeAssemblyFromHostfxr(
|
|||
|
||||
DBG_ASSERT(struFileName != NULL);
|
||||
|
||||
hmHostFxrDll = LoadLibraryW(m_pConfiguration->QueryHostFxrFullPath());
|
||||
hmHostFxrDll = LoadLibraryW(hostfxrOptions->GetHostFxrLocation());
|
||||
|
||||
if (hmHostFxrDll == NULL)
|
||||
{
|
||||
|
|
@ -446,8 +467,8 @@ APPLICATION_INFO::FindNativeAssemblyFromHostfxr(
|
|||
while (TRUE)
|
||||
{
|
||||
intHostFxrExitCode = pFnHostFxrSearchDirectories(
|
||||
m_pConfiguration->QueryHostFxrArgCount(),
|
||||
m_pConfiguration->QueryHostFxrArguments(),
|
||||
hostfxrOptions->GetArgc(),
|
||||
hostfxrOptions->GetArgv(),
|
||||
struNativeSearchPaths.QueryStr(),
|
||||
dwBufferSize,
|
||||
&dwRequiredBufferSize
|
||||
|
|
@ -498,7 +519,7 @@ APPLICATION_INFO::FindNativeAssemblyFromHostfxr(
|
|||
}
|
||||
}
|
||||
|
||||
if (FAILED(hr = struNativeDllLocation.Append(g_pwzAspnetcoreInProcessRequestHandlerName)))
|
||||
if (FAILED(hr = struNativeDllLocation.Append(libraryName)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,6 @@
|
|||
|
||||
ASPNETCORE_SHIM_CONFIG::~ASPNETCORE_SHIM_CONFIG()
|
||||
{
|
||||
if (m_ppStrArguments != NULL)
|
||||
{
|
||||
delete[] m_ppStrArguments;
|
||||
m_ppStrArguments = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
|
|
@ -38,8 +33,6 @@ ASPNETCORE_SHIM_CONFIG::GetConfig(
|
|||
_In_ IHttpServer *pHttpServer,
|
||||
_In_ HTTP_MODULE_ID pModuleId,
|
||||
_In_ IHttpApplication *pHttpApplication,
|
||||
_In_ HANDLE hEventLog,
|
||||
_Out_ STRU *struExeLocation,
|
||||
_Out_ ASPNETCORE_SHIM_CONFIG **ppAspNetCoreShimConfig
|
||||
)
|
||||
{
|
||||
|
|
@ -47,8 +40,7 @@ ASPNETCORE_SHIM_CONFIG::GetConfig(
|
|||
ASPNETCORE_SHIM_CONFIG *pAspNetCoreShimConfig = NULL;
|
||||
STRU struHostFxrDllLocation;
|
||||
STRU struExeAbsolutePath;
|
||||
BSTR* pwzArgv;
|
||||
DWORD dwArgCount;
|
||||
|
||||
if (ppAspNetCoreShimConfig == NULL)
|
||||
{
|
||||
hr = E_INVALIDARG;
|
||||
|
|
@ -81,32 +73,6 @@ ASPNETCORE_SHIM_CONFIG::GetConfig(
|
|||
goto Finished;
|
||||
}
|
||||
|
||||
// Modify Inprocess specific configuration here.
|
||||
if (pAspNetCoreShimConfig->QueryHostingModel() == APP_HOSTING_MODEL::HOSTING_IN_PROCESS)
|
||||
{
|
||||
if (FAILED(hr = HOSTFXR_UTILITY::GetHostFxrParameters(
|
||||
hEventLog,
|
||||
pAspNetCoreShimConfig->QueryProcessPath()->QueryStr(),
|
||||
pAspNetCoreShimConfig->QueryApplicationPhysicalPath()->QueryStr(),
|
||||
pAspNetCoreShimConfig->QueryArguments()->QueryStr(),
|
||||
&struHostFxrDllLocation,
|
||||
&struExeAbsolutePath,
|
||||
&dwArgCount,
|
||||
&pwzArgv)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
if (FAILED(hr = pAspNetCoreShimConfig->SetHostFxrFullPath(struHostFxrDllLocation.QueryStr())))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
pAspNetCoreShimConfig->SetHostFxrArguments(dwArgCount, pwzArgv);
|
||||
|
||||
struExeLocation->Copy(struExeAbsolutePath);
|
||||
}
|
||||
|
||||
hr = pHttpApplication->GetModuleContextContainer()->
|
||||
SetModuleContext(pAspNetCoreShimConfig, pModuleId);
|
||||
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ inline bool IsSpace(char ch)
|
|||
#include "globalmodule.h"
|
||||
#include "proxymodule.h"
|
||||
#include "applicationinfo.h"
|
||||
|
||||
#include "hostfxroptions.h"
|
||||
|
||||
FORCEINLINE
|
||||
DWORD
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
#include "precomp.hxx"
|
||||
#include "hostfxroptions.h"
|
||||
|
||||
__override
|
||||
HRESULT
|
||||
|
|
@ -81,7 +82,6 @@ ASPNET_CORE_PROXY_MODULE::OnExecuteRequestHandler(
|
|||
APPLICATION_MANAGER *pApplicationManager = NULL;
|
||||
REQUEST_NOTIFICATION_STATUS retVal = RQ_NOTIFICATION_CONTINUE;
|
||||
IAPPLICATION* pApplication = NULL;
|
||||
STRU struExeLocation;
|
||||
STACK_STRU(struFileName, 256);
|
||||
|
||||
if (g_fInShutdown)
|
||||
|
|
@ -90,7 +90,7 @@ ASPNET_CORE_PROXY_MODULE::OnExecuteRequestHandler(
|
|||
goto Finished;
|
||||
}
|
||||
|
||||
hr = ASPNETCORE_SHIM_CONFIG::GetConfig(g_pHttpServer, g_pModuleId, pHttpContext->GetApplication(), g_hEventLog, &struExeLocation, &pConfig);
|
||||
hr = ASPNETCORE_SHIM_CONFIG::GetConfig(g_pHttpServer, g_pModuleId, pHttpContext->GetApplication(), &pConfig);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
goto Finished;
|
||||
|
|
@ -144,7 +144,7 @@ ASPNET_CORE_PROXY_MODULE::OnExecuteRequestHandler(
|
|||
}
|
||||
|
||||
// make sure assmebly is loaded and application is created
|
||||
hr = m_pApplicationInfo->EnsureApplicationCreated(pHttpContext, &struExeLocation);
|
||||
hr = m_pApplicationInfo->EnsureApplicationCreated(pHttpContext);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
goto Finished;
|
||||
|
|
|
|||
|
|
@ -1,228 +1,230 @@
|
|||
<?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="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{55494E58-E061-4C4C-A0A8-837008E72F85}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>NewCommon</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.15063.0</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)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<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|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</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 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 Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<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|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>C:\AspNetCoreModule\src\IISLib;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
||||
<AdditionalUsingDirectories>
|
||||
</AdditionalUsingDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalLibraryDirectories>..\iislib</AdditionalLibraryDirectories>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="application.h" />
|
||||
<ClInclude Include="fx_ver.h" />
|
||||
<ClInclude Include="hostfxr_utility.h" />
|
||||
<ClInclude Include="iapplication.h" />
|
||||
<ClInclude Include="debugutil.h" />
|
||||
<ClInclude Include="disconnectcontext.h" />
|
||||
<ClInclude Include="environmentvariablehash.h" />
|
||||
<ClInclude Include="irequesthandler.h" />
|
||||
<ClInclude Include="requesthandler.h" />
|
||||
<ClInclude Include="requesthandler_config.h" />
|
||||
<ClInclude Include="resources.h" />
|
||||
<ClInclude Include="SRWLockWrapper.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="utility.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="fx_ver.cxx" />
|
||||
<ClCompile Include="hostfxr_utility.cpp" />
|
||||
<ClCompile Include="requesthandler_config.cpp" />
|
||||
<ClCompile Include="SRWLockWrapper.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="utility.cxx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\IISLib\IISLib.vcxproj">
|
||||
<Project>{4787a64f-9a3e-4867-a55a-70cb4b2b2ffe}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="aspnetcore_msg.mc">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">mc %(FullPath)</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling Event Messages ...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">mc %(FullPath)</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compiling Event Messages ...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mc %(FullPath)</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling Event Messages ...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">mc %(FullPath)</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compiling Event Messages ...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<?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="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{55494E58-E061-4C4C-A0A8-837008E72F85}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>NewCommon</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.15063.0</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)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<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|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</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 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 Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<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|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>C:\AspNetCoreModule\src\IISLib;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>false</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<AdditionalIncludeDirectories>..\iislib;</AdditionalIncludeDirectories>
|
||||
<AdditionalUsingDirectories>
|
||||
</AdditionalUsingDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<ShowIncludes>false</ShowIncludes>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<Lib>
|
||||
<AdditionalLibraryDirectories>..\iislib</AdditionalLibraryDirectories>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="application.h" />
|
||||
<ClInclude Include="fx_ver.h" />
|
||||
<ClInclude Include="hostfxroptions.h" />
|
||||
<ClInclude Include="hostfxr_utility.h" />
|
||||
<ClInclude Include="iapplication.h" />
|
||||
<ClInclude Include="debugutil.h" />
|
||||
<ClInclude Include="disconnectcontext.h" />
|
||||
<ClInclude Include="environmentvariablehash.h" />
|
||||
<ClInclude Include="irequesthandler.h" />
|
||||
<ClInclude Include="requesthandler.h" />
|
||||
<ClInclude Include="requesthandler_config.h" />
|
||||
<ClInclude Include="resources.h" />
|
||||
<ClInclude Include="SRWLockWrapper.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="utility.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="fx_ver.cxx" />
|
||||
<ClCompile Include="hostfxroptions.cpp" />
|
||||
<ClCompile Include="hostfxr_utility.cpp" />
|
||||
<ClCompile Include="requesthandler_config.cpp" />
|
||||
<ClCompile Include="SRWLockWrapper.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="utility.cxx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\IISLib\IISLib.vcxproj">
|
||||
<Project>{4787a64f-9a3e-4867-a55a-70cb4b2b2ffe}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="aspnetcore_msg.mc">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">mc %(FullPath)</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Compiling Event Messages ...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">mc %(FullPath)</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Compiling Event Messages ...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mc %(FullPath)</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling Event Messages ...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">mc %(FullPath)</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Compiling Event Messages ...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).rc;%(Filename).h;MSG0409.bin</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
@ -98,9 +98,10 @@ public:
|
|||
dwResult = GetEnvironmentVariable(struNameBuffer.QueryStr(),
|
||||
struValueBuffer.QueryStr(),
|
||||
struValueBuffer.QuerySizeCCH());
|
||||
if (struValueBuffer.IsEmpty())
|
||||
|
||||
if (dwResult <= 0)
|
||||
{
|
||||
hr = E_UNEXPECTED;
|
||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
goto Finished;
|
||||
}
|
||||
fFound = TRUE;
|
||||
|
|
@ -304,7 +305,7 @@ public:
|
|||
dwResult = GetEnvironmentVariable(HOSTING_STARTUP_ASSEMBLIES_ENV_STR,
|
||||
strStartupAssemblyEnv.QueryStr(),
|
||||
strStartupAssemblyEnv.QuerySizeCCH());
|
||||
if (strStartupAssemblyEnv.IsEmpty())
|
||||
if (dwResult <= 0)
|
||||
{
|
||||
hr = E_UNEXPECTED;
|
||||
goto Finished;
|
||||
|
|
@ -317,11 +318,14 @@ public:
|
|||
}
|
||||
|
||||
strStartupAssemblyEnv.SyncWithBuffer();
|
||||
if (strStartupAssemblyEnv.IndexOf(HOSTING_STARTUP_ASSEMBLIES_VALUE) == -1)
|
||||
{
|
||||
if (fFound)
|
||||
{
|
||||
strStartupAssemblyEnv.Append(L";");
|
||||
}
|
||||
strStartupAssemblyEnv.Append(HOSTING_STARTUP_ASSEMBLIES_VALUE);
|
||||
}
|
||||
|
||||
// the environment variable was not defined, create it and add to hashtable
|
||||
pHostingEntry = new ENVIRONMENT_VAR_ENTRY();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,102 @@
|
|||
// 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"
|
||||
|
||||
HRESULT HOSTFXR_OPTIONS::Create(
|
||||
_In_ PCWSTR pcwzExeLocation,
|
||||
_In_ PCWSTR pcwzProcessPath,
|
||||
_In_ PCWSTR pcwzApplicationPhysicalPath,
|
||||
_In_ PCWSTR pcwzArguments,
|
||||
_In_ HANDLE hEventLog,
|
||||
_Out_ std::unique_ptr<HOSTFXR_OPTIONS>& ppWrapper)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
STRU struHostFxrDllLocation;
|
||||
STRU struExeAbsolutePath;
|
||||
STRU struExeLocation;
|
||||
BSTR* pwzArgv;
|
||||
DWORD dwArgCount;
|
||||
|
||||
if (pcwzExeLocation != NULL && FAILED(struExeLocation.Copy(pcwzExeLocation)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
// If the exe was not provided by the shim, reobtain the hostfxr parameters (which finds dotnet).
|
||||
if (struExeLocation.IsEmpty())
|
||||
{
|
||||
if (FAILED(hr = HOSTFXR_UTILITY::GetHostFxrParameters(
|
||||
hEventLog,
|
||||
pcwzProcessPath,
|
||||
pcwzApplicationPhysicalPath,
|
||||
pcwzArguments,
|
||||
&struHostFxrDllLocation,
|
||||
&struExeAbsolutePath,
|
||||
&dwArgCount,
|
||||
&pwzArgv)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
}
|
||||
else if (HOSTFXR_UTILITY::IsDotnetExecutable(&struExeLocation))
|
||||
{
|
||||
if (FAILED(hr = HOSTFXR_UTILITY::ParseHostfxrArguments(
|
||||
pcwzArguments,
|
||||
pcwzExeLocation,
|
||||
pcwzApplicationPhysicalPath,
|
||||
hEventLog,
|
||||
&dwArgCount,
|
||||
&pwzArgv)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FAILED(hr = HOSTFXR_UTILITY::GetStandaloneHostfxrParameters(
|
||||
pcwzExeLocation,
|
||||
pcwzApplicationPhysicalPath,
|
||||
pcwzArguments,
|
||||
hEventLog,
|
||||
&struHostFxrDllLocation,
|
||||
&dwArgCount,
|
||||
&pwzArgv)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
}
|
||||
|
||||
ppWrapper = std::make_unique<HOSTFXR_OPTIONS>();
|
||||
if (FAILED(hr = ppWrapper->Populate(struHostFxrDllLocation.QueryStr(), struExeAbsolutePath.QueryStr(), dwArgCount, pwzArgv)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
Finished:
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
||||
HRESULT HOSTFXR_OPTIONS::Populate(PCWSTR hostFxrLocation, PCWSTR struExeLocation, DWORD argc, BSTR argv[])
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
m_argc = argc;
|
||||
m_argv = argv;
|
||||
|
||||
if (FAILED(hr = m_hostFxrLocation.Copy(hostFxrLocation)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
if (FAILED(hr = m_exeLocation.Copy(struExeLocation)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
Finished:
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
#pragma once
|
||||
|
||||
class HOSTFXR_OPTIONS
|
||||
{
|
||||
public:
|
||||
HOSTFXR_OPTIONS() {}
|
||||
|
||||
~HOSTFXR_OPTIONS()
|
||||
{
|
||||
delete[] m_argv;
|
||||
}
|
||||
|
||||
DWORD
|
||||
GetArgc() const
|
||||
{
|
||||
return m_argc;
|
||||
}
|
||||
|
||||
BSTR*
|
||||
GetArgv() const
|
||||
{
|
||||
return m_argv;
|
||||
}
|
||||
|
||||
PCWSTR
|
||||
GetHostFxrLocation() const
|
||||
{
|
||||
return m_hostFxrLocation.QueryStr();
|
||||
}
|
||||
|
||||
PCWSTR
|
||||
GetExeLocation() const
|
||||
{
|
||||
return m_exeLocation.QueryStr();
|
||||
}
|
||||
|
||||
static
|
||||
HRESULT Create(
|
||||
_In_ PCWSTR pcwzExeLocation,
|
||||
_In_ PCWSTR pcwzProcessPath,
|
||||
_In_ PCWSTR pcwzApplicationPhysicalPath,
|
||||
_In_ PCWSTR pcwzArguments,
|
||||
_In_ HANDLE hEventLog,
|
||||
_Out_ std::unique_ptr<HOSTFXR_OPTIONS>& ppWrapper);
|
||||
|
||||
private:
|
||||
|
||||
HRESULT Populate(PCWSTR hostFxrLocation, PCWSTR struExeLocation, DWORD argc, BSTR argv[]);
|
||||
|
||||
STRU m_exeLocation;
|
||||
STRU m_hostFxrLocation;
|
||||
|
||||
DWORD m_argc;
|
||||
BSTR* m_argv;
|
||||
};
|
||||
|
|
@ -25,16 +25,12 @@ HRESULT
|
|||
REQUESTHANDLER_CONFIG::CreateRequestHandlerConfig(
|
||||
_In_ IHttpServer *pHttpServer,
|
||||
_In_ IHttpApplication *pHttpApplication,
|
||||
_In_ PCWSTR pwzExeLocation,
|
||||
_In_ HANDLE hEventLog,
|
||||
_Out_ REQUESTHANDLER_CONFIG **ppAspNetCoreConfig
|
||||
)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
REQUESTHANDLER_CONFIG *pRequestHandlerConfig = NULL;
|
||||
STRU struHostFxrDllLocation;
|
||||
BSTR* pwzArgv;
|
||||
DWORD dwArgCount;
|
||||
STRU struExeLocation;
|
||||
|
||||
if (ppAspNetCoreConfig == NULL)
|
||||
|
|
@ -58,60 +54,6 @@ REQUESTHANDLER_CONFIG::CreateRequestHandlerConfig(
|
|||
goto Finished;
|
||||
}
|
||||
|
||||
// Modify config for inprocess.
|
||||
if (pRequestHandlerConfig->QueryHostingModel() == APP_HOSTING_MODEL::HOSTING_IN_PROCESS)
|
||||
{
|
||||
if (FAILED(struExeLocation.Copy(pwzExeLocation)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
// If the exe was not provided by the shim, reobtain the hostfxr parameters (which finds dotnet).
|
||||
if (struExeLocation.IsEmpty())
|
||||
{
|
||||
if (FAILED(hr = HOSTFXR_UTILITY::GetHostFxrParameters(
|
||||
hEventLog,
|
||||
pRequestHandlerConfig->QueryProcessPath()->QueryStr(),
|
||||
pRequestHandlerConfig->QueryApplicationPhysicalPath()->QueryStr(),
|
||||
pRequestHandlerConfig->QueryArguments()->QueryStr(),
|
||||
&struHostFxrDllLocation,
|
||||
&struExeLocation,
|
||||
&dwArgCount,
|
||||
&pwzArgv)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
}
|
||||
else if (HOSTFXR_UTILITY::IsDotnetExecutable(&struExeLocation))
|
||||
{
|
||||
if (FAILED(hr = HOSTFXR_UTILITY::ParseHostfxrArguments(
|
||||
pRequestHandlerConfig->QueryArguments()->QueryStr(),
|
||||
pwzExeLocation,
|
||||
pRequestHandlerConfig->QueryApplicationPhysicalPath()->QueryStr(),
|
||||
hEventLog,
|
||||
&dwArgCount,
|
||||
&pwzArgv)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FAILED(hr = HOSTFXR_UTILITY::GetStandaloneHostfxrParameters(
|
||||
pwzExeLocation,
|
||||
pRequestHandlerConfig->QueryApplicationPhysicalPath()->QueryStr(),
|
||||
pRequestHandlerConfig->QueryArguments()->QueryStr(),
|
||||
hEventLog,
|
||||
&struHostFxrDllLocation,
|
||||
&dwArgCount,
|
||||
&pwzArgv)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
}
|
||||
|
||||
pRequestHandlerConfig->SetHostFxrArguments(dwArgCount, pwzArgv);
|
||||
}
|
||||
|
||||
DebugPrintf(ASPNETCORE_DEBUG_FLAG_INFO,
|
||||
"REQUESTHANDLER_CONFIG::GetConfig, set config to ModuleContext");
|
||||
// set appliction info here instead of inside Populate()
|
||||
|
|
|
|||
|
|
@ -62,8 +62,6 @@ public:
|
|||
CreateRequestHandlerConfig(
|
||||
_In_ IHttpServer *pHttpServer,
|
||||
_In_ IHttpApplication *pHttpApplication,
|
||||
_In_ PCWSTR pwzExeLocation,
|
||||
_In_ HANDLE hEventLog,
|
||||
_Out_ REQUESTHANDLER_CONFIG **ppAspNetCoreConfig
|
||||
);
|
||||
|
||||
|
|
@ -211,45 +209,11 @@ public:
|
|||
return &m_struConfigPath;
|
||||
}
|
||||
|
||||
CONST
|
||||
PCWSTR*
|
||||
QueryHostFxrArguments(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return m_ppStrArguments;
|
||||
}
|
||||
|
||||
CONST
|
||||
DWORD
|
||||
QueryHostFxrArgCount(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return m_dwArgc;
|
||||
}
|
||||
|
||||
CONST
|
||||
VOID
|
||||
SetHostFxrArguments(
|
||||
DWORD dwArgc,
|
||||
PWSTR* ppStrArguments
|
||||
)
|
||||
{
|
||||
if (m_ppStrArguments != NULL)
|
||||
{
|
||||
delete[] m_ppStrArguments;
|
||||
}
|
||||
|
||||
m_dwArgc = dwArgc;
|
||||
m_ppStrArguments = ppStrArguments;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//
|
||||
// private constructor
|
||||
//
|
||||
//
|
||||
REQUESTHANDLER_CONFIG() :
|
||||
m_fStdoutLogEnabled(FALSE),
|
||||
m_pEnvironmentVariables(NULL),
|
||||
|
|
|
|||
|
|
@ -32,4 +32,4 @@
|
|||
#include "aspnetcore_msg.h"
|
||||
#include "fx_ver.h"
|
||||
#include "hostfxr_utility.h"
|
||||
|
||||
#include "hostfxroptions.h"
|
||||
|
|
|
|||
|
|
@ -113,13 +113,13 @@ CreateApplication(
|
|||
// Initialze some global variables here
|
||||
InitializeGlobalConfiguration(pServer);
|
||||
|
||||
hr = REQUESTHANDLER_CONFIG::CreateRequestHandlerConfig(pServer, pHttpContext->GetApplication(), pwzExeLocation, g_hEventLog, &pConfig);
|
||||
hr = REQUESTHANDLER_CONFIG::CreateRequestHandlerConfig(pServer, pHttpContext->GetApplication(), &pConfig);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return hr;
|
||||
}
|
||||
|
||||
pApplication = new IN_PROCESS_APPLICATION(pServer, pConfig);
|
||||
pApplication = new IN_PROCESS_APPLICATION(pServer, pConfig, pwzExeLocation);
|
||||
if (pApplication == NULL)
|
||||
{
|
||||
hr = HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
#include "..\precomp.hxx"
|
||||
#include "hostfxroptions.h"
|
||||
|
||||
IN_PROCESS_APPLICATION* IN_PROCESS_APPLICATION::s_Application = NULL;
|
||||
hostfxr_main_fn IN_PROCESS_APPLICATION::s_fMainCallback = NULL;
|
||||
|
||||
IN_PROCESS_APPLICATION::IN_PROCESS_APPLICATION(
|
||||
IHttpServer* pHttpServer,
|
||||
REQUESTHANDLER_CONFIG *pConfig) :
|
||||
IHttpServer *pHttpServer,
|
||||
REQUESTHANDLER_CONFIG *pConfig,
|
||||
PCWSTR pDotnetExeLocation) :
|
||||
m_pHttpServer(pHttpServer),
|
||||
m_ProcessExitCode(0),
|
||||
m_hLogFileHandle(INVALID_HANDLE_VALUE),
|
||||
|
|
@ -16,7 +19,8 @@ IN_PROCESS_APPLICATION::IN_PROCESS_APPLICATION(
|
|||
m_fInitialized(FALSE),
|
||||
m_fShutdownCalledFromNative(FALSE),
|
||||
m_fShutdownCalledFromManaged(FALSE),
|
||||
m_srwLock()
|
||||
m_srwLock(),
|
||||
m_pstrDotnetExeLocation(pDotnetExeLocation)
|
||||
{
|
||||
// is it guaranteed that we have already checked app offline at this point?
|
||||
// If so, I don't think there is much to do here.
|
||||
|
|
@ -116,7 +120,7 @@ Finished:
|
|||
// Managed layer may block the shutdown and lead to shutdown timeout
|
||||
// Assumption: only one inprocess application is hosted.
|
||||
// Call process exit to force shutdown
|
||||
//
|
||||
//
|
||||
exit(hr);
|
||||
}
|
||||
}
|
||||
|
|
@ -262,7 +266,6 @@ IN_PROCESS_APPLICATION::Recycle(
|
|||
// IISExpress scenario
|
||||
// Shutdown the managed application and call exit to terminate current process
|
||||
ShutDown();
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -808,33 +811,55 @@ IN_PROCESS_APPLICATION::ExecuteApplication(
|
|||
)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
HMODULE hModule;
|
||||
HMODULE hModule = nullptr;
|
||||
DWORD hostfxrArgc = 0;
|
||||
BSTR *hostfxrArgv = NULL;
|
||||
hostfxr_main_fn pProc;
|
||||
std::unique_ptr<HOSTFXR_OPTIONS> hostFxrOptions = NULL;
|
||||
|
||||
DBG_ASSERT(m_status == APPLICATION_STATUS::STARTING);
|
||||
|
||||
// hostfxr should already be loaded by the shim. If not, then we will need
|
||||
// to load it ourselves by finding hostfxr again.
|
||||
hModule = LoadLibraryW(L"hostfxr.dll");
|
||||
|
||||
if (hModule == NULL)
|
||||
pProc = s_fMainCallback;
|
||||
if (pProc == nullptr)
|
||||
{
|
||||
// .NET Core not installed (we can log a more detailed error message here)
|
||||
hr = ERROR_BAD_ENVIRONMENT;
|
||||
goto Finished;
|
||||
}
|
||||
// hostfxr should already be loaded by the shim. If not, then we will need
|
||||
// to load it ourselves by finding hostfxr again.
|
||||
hModule = LoadLibraryW(L"hostfxr.dll");
|
||||
|
||||
// Get the entry point for main
|
||||
pProc = (hostfxr_main_fn)GetProcAddress(hModule, "hostfxr_main");
|
||||
if (pProc == NULL)
|
||||
{
|
||||
hr = ERROR_BAD_ENVIRONMENT;
|
||||
goto Finished;
|
||||
}
|
||||
if (hModule == NULL)
|
||||
{
|
||||
// .NET Core not installed (we can log a more detailed error message here)
|
||||
hr = ERROR_BAD_ENVIRONMENT;
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
if (FAILED(hr = SetEnvironementVariablesOnWorkerProcess()))
|
||||
{
|
||||
goto Finished;
|
||||
// Get the entry point for main
|
||||
pProc = (hostfxr_main_fn)GetProcAddress(hModule, "hostfxr_main");
|
||||
if (pProc == NULL)
|
||||
{
|
||||
hr = ERROR_BAD_ENVIRONMENT;
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
if (FAILED(hr = HOSTFXR_OPTIONS::Create(
|
||||
m_pstrDotnetExeLocation,
|
||||
m_pConfig->QueryProcessPath()->QueryStr(),
|
||||
m_pConfig->QueryApplicationPhysicalPath()->QueryStr(),
|
||||
m_pConfig->QueryArguments()->QueryStr(),
|
||||
g_hEventLog,
|
||||
hostFxrOptions
|
||||
)))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
|
||||
hostfxrArgc = hostFxrOptions->GetArgc();
|
||||
hostfxrArgv = hostFxrOptions->GetArgv();
|
||||
|
||||
if (FAILED(hr = SetEnvironementVariablesOnWorkerProcess()))
|
||||
{
|
||||
goto Finished;
|
||||
}
|
||||
}
|
||||
|
||||
// There can only ever be a single instance of .NET Core
|
||||
|
|
@ -845,7 +870,7 @@ IN_PROCESS_APPLICATION::ExecuteApplication(
|
|||
// set the callbacks
|
||||
s_Application = this;
|
||||
|
||||
hr = RunDotnetApplication(m_pConfig->QueryHostFxrArgCount(), m_pConfig->QueryHostFxrArguments(), pProc);
|
||||
hr = RunDotnetApplication(hostfxrArgc, hostfxrArgv, pProc);
|
||||
|
||||
Finished:
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,10 @@ typedef REQUEST_NOTIFICATION_STATUS(WINAPI * PFN_MANAGED_CONTEXT_HANDLER)(void *
|
|||
class IN_PROCESS_APPLICATION : public APPLICATION
|
||||
{
|
||||
public:
|
||||
IN_PROCESS_APPLICATION(IHttpServer* pHttpServer, REQUESTHANDLER_CONFIG *pConfig);
|
||||
IN_PROCESS_APPLICATION(
|
||||
IHttpServer* pHttpServer,
|
||||
REQUESTHANDLER_CONFIG *pConfig,
|
||||
PCWSTR pDotnetExeLocation);
|
||||
|
||||
~IN_PROCESS_APPLICATION();
|
||||
|
||||
|
|
@ -102,6 +105,12 @@ public:
|
|||
m_fShutdownCalledFromManaged = TRUE;
|
||||
}
|
||||
|
||||
static
|
||||
VOID SetMainCallback(hostfxr_main_fn mainCallback)
|
||||
{
|
||||
s_fMainCallback = mainCallback;
|
||||
}
|
||||
|
||||
static
|
||||
IN_PROCESS_APPLICATION*
|
||||
GetInstance(
|
||||
|
|
@ -176,10 +185,15 @@ private:
|
|||
HANDLE m_hErrThread;
|
||||
CHAR m_pzFileContents[4096] = { 0 };
|
||||
DWORD m_dwStdErrReadTotal;
|
||||
PCWSTR m_pstrDotnetExeLocation;
|
||||
static IN_PROCESS_APPLICATION* s_Application;
|
||||
|
||||
REQUESTHANDLER_CONFIG* m_pConfig;
|
||||
|
||||
// Allows to override call to hostfxr_main with custome callback
|
||||
// used in testing
|
||||
static hostfxr_main_fn s_fMainCallback;
|
||||
|
||||
VOID
|
||||
SetStdOut(
|
||||
VOID
|
||||
|
|
|
|||
|
|
@ -442,4 +442,11 @@ http_stop_incoming_requests()
|
|||
IN_PROCESS_APPLICATION::GetInstance()->StopIncomingRequests();
|
||||
}
|
||||
|
||||
EXTERN_C __MIDL_DECLSPEC_DLLEXPORT
|
||||
VOID
|
||||
set_main_handler(_In_ hostfxr_main_fn main)
|
||||
{
|
||||
IN_PROCESS_APPLICATION::SetMainCallback(main);
|
||||
}
|
||||
|
||||
// End of export
|
||||
|
|
|
|||
|
|
@ -285,10 +285,12 @@ CreateApplication(
|
|||
HRESULT hr = S_OK;
|
||||
IAPPLICATION *pApplication = NULL;
|
||||
REQUESTHANDLER_CONFIG *pConfig = NULL;
|
||||
UNREFERENCED_PARAMETER(pwzExeLocation);
|
||||
|
||||
// Initialze some global variables here
|
||||
InitializeGlobalConfiguration(pServer);
|
||||
|
||||
hr = REQUESTHANDLER_CONFIG::CreateRequestHandlerConfig(pServer, pHttpContext->GetApplication(), pwzExeLocation, g_hEventLog, &pConfig);
|
||||
hr = REQUESTHANDLER_CONFIG::CreateRequestHandlerConfig(pServer, pHttpContext->GetApplication(), &pConfig);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return hr;
|
||||
|
|
|
|||
|
|
@ -136,6 +136,8 @@ namespace Microsoft.AspNetCore.Server.IIS.Core
|
|||
}
|
||||
|
||||
_memoryPool.Dispose();
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private static NativeMethods.REQUEST_NOTIFICATION_STATUS HandleRequest(IntPtr pInProcessHandler, IntPtr pvRequestContext)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Server.IIS
|
|||
|
||||
private const string KERNEL32 = "kernel32.dll";
|
||||
|
||||
private const string AspNetCoreModuleDll = "aspnetcorev2_inprocess.dll";
|
||||
internal const string AspNetCoreModuleDll = "aspnetcorev2_inprocess.dll";
|
||||
|
||||
[DllImport(KERNEL32, ExactSpelling = true, SetLastError = true)]
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,201 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
IIS configuration sections.
|
||||
|
||||
For schema documentation, see
|
||||
%windir%\system32\inetsrv\config\schema\IIS_schema.xml.
|
||||
|
||||
Please make a backup of this file before making any changes to it.
|
||||
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
|
||||
<!--
|
||||
|
||||
The <configSections> section controls the registration of sections.
|
||||
Section is the basic unit of deployment, locking, searching and
|
||||
containment for configuration settings.
|
||||
|
||||
Every section belongs to one section group.
|
||||
A section group is a container of logically-related sections.
|
||||
|
||||
Sections cannot be nested.
|
||||
Section groups may be nested.
|
||||
|
||||
<section
|
||||
name="" [Required, Collection Key] [XML name of the section]
|
||||
allowDefinition="Everywhere" [MachineOnly|MachineToApplication|AppHostOnly|Everywhere] [Level where it can be set]
|
||||
overrideModeDefault="Allow" [Allow|Deny] [Default delegation mode]
|
||||
allowLocation="true" [true|false] [Allowed in location tags]
|
||||
/>
|
||||
|
||||
The recommended way to unlock sections is by using a location tag:
|
||||
<location path="Default Web Site" overrideMode="Allow">
|
||||
<system.webServer>
|
||||
<asp />
|
||||
</system.webServer>
|
||||
</location>
|
||||
|
||||
-->
|
||||
<configSections>
|
||||
<sectionGroup name="system.applicationHost">
|
||||
<section name="applicationPools" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
|
||||
<section name="configHistory" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
|
||||
<section name="customMetadata" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
|
||||
<section name="listenerAdapters" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
|
||||
<section name="log" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
|
||||
<section name="serviceAutoStartProviders" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
|
||||
<section name="sites" overrideModeDefault="Allow" />
|
||||
<section name="webLimits" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
|
||||
</sectionGroup>
|
||||
|
||||
<sectionGroup name="system.webServer">
|
||||
<section name="asp" overrideModeDefault="Deny" />
|
||||
<section name="caching" overrideModeDefault="Allow" />
|
||||
<section name="aspNetCore" overrideModeDefault="Allow" />
|
||||
<section name="cgi" overrideModeDefault="Deny" />
|
||||
<section name="defaultDocument" overrideModeDefault="Allow" />
|
||||
<section name="directoryBrowse" overrideModeDefault="Allow" />
|
||||
<section name="fastCgi" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
|
||||
<section name="globalModules" overrideModeDefault="Allow" />
|
||||
<section name="handlers" allowDefinition="MachineToApplication" overrideModeDefault="Allow" />
|
||||
<section name="httpCompression" overrideModeDefault="Allow" />
|
||||
<section name="httpErrors" overrideModeDefault="Allow" />
|
||||
<section name="httpLogging" overrideModeDefault="Deny" />
|
||||
<section name="httpProtocol" overrideModeDefault="Allow" />
|
||||
<section name="httpRedirect" overrideModeDefault="Allow" />
|
||||
<section name="httpTracing" overrideModeDefault="Deny" />
|
||||
<section name="isapiFilters" allowDefinition="MachineToApplication" overrideModeDefault="Deny" />
|
||||
<section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Deny" />
|
||||
<section name="applicationInitialization" allowDefinition="MachineToApplication" overrideModeDefault="Allow" />
|
||||
<section name="odbcLogging" overrideModeDefault="Deny" />
|
||||
<sectionGroup name="security">
|
||||
<section name="access" overrideModeDefault="Deny" />
|
||||
<section name="applicationDependencies" overrideModeDefault="Deny" />
|
||||
<sectionGroup name="authentication">
|
||||
<section name="anonymousAuthentication" overrideModeDefault="Deny" />
|
||||
<section name="basicAuthentication" overrideModeDefault="Deny" />
|
||||
<section name="clientCertificateMappingAuthentication" overrideModeDefault="Deny" />
|
||||
<section name="digestAuthentication" overrideModeDefault="Deny" />
|
||||
<section name="iisClientCertificateMappingAuthentication" overrideModeDefault="Deny" />
|
||||
<section name="windowsAuthentication" overrideModeDefault="Deny" />
|
||||
</sectionGroup>
|
||||
<section name="authorization" overrideModeDefault="Allow" />
|
||||
<section name="ipSecurity" overrideModeDefault="Deny" />
|
||||
<section name="dynamicIpSecurity" overrideModeDefault="Deny" />
|
||||
<section name="isapiCgiRestriction" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
|
||||
<section name="requestFiltering" overrideModeDefault="Allow" />
|
||||
</sectionGroup>
|
||||
<section name="serverRuntime" overrideModeDefault="Deny" />
|
||||
<section name="serverSideInclude" overrideModeDefault="Deny" />
|
||||
<section name="staticContent" overrideModeDefault="Allow" />
|
||||
<sectionGroup name="tracing">
|
||||
<section name="traceFailedRequests" overrideModeDefault="Allow" />
|
||||
<section name="traceProviderDefinitions" overrideModeDefault="Deny" />
|
||||
</sectionGroup>
|
||||
<section name="urlCompression" overrideModeDefault="Allow" />
|
||||
<section name="validation" overrideModeDefault="Allow" />
|
||||
<sectionGroup name="webdav">
|
||||
<section name="globalSettings" overrideModeDefault="Deny" />
|
||||
<section name="authoring" overrideModeDefault="Deny" />
|
||||
<section name="authoringRules" overrideModeDefault="Deny" />
|
||||
</sectionGroup>
|
||||
<section name="webSocket" overrideModeDefault="Deny" />
|
||||
</sectionGroup>
|
||||
<sectionGroup name="system.ftpServer">
|
||||
<section name="log" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
|
||||
<section name="firewallSupport" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
|
||||
<section name="caching" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
|
||||
<section name="providerDefinitions" overrideModeDefault="Deny" />
|
||||
<sectionGroup name="security">
|
||||
<section name="ipSecurity" overrideModeDefault="Deny" />
|
||||
<section name="requestFiltering" overrideModeDefault="Deny" />
|
||||
<section name="authorization" overrideModeDefault="Deny" />
|
||||
<section name="authentication" overrideModeDefault="Deny" />
|
||||
</sectionGroup>
|
||||
<section name="serverRuntime" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
<system.applicationHost>
|
||||
|
||||
<applicationPools>
|
||||
<add name="DefaultAppPool" />
|
||||
<applicationPoolDefaults managedRuntimeVersion="v4.0">
|
||||
<processModel identityType="ApplicationPoolIdentity" />
|
||||
</applicationPoolDefaults>
|
||||
</applicationPools>
|
||||
|
||||
<!--
|
||||
|
||||
The <customMetadata> section is used internally by the Admin Base Objects
|
||||
(ABO) Compatibility component. Please do not modify its content.
|
||||
|
||||
-->
|
||||
<customMetadata />
|
||||
|
||||
<!--
|
||||
|
||||
The <listenerAdapters> section defines the protocols with which the
|
||||
Windows Process Activation Service (WAS) binds.
|
||||
|
||||
-->
|
||||
<listenerAdapters>
|
||||
<add name="http" />
|
||||
</listenerAdapters>
|
||||
|
||||
<log>
|
||||
<centralBinaryLogFile enabled="false" />
|
||||
<centralW3CLogFile enabled="false" />
|
||||
</log>
|
||||
|
||||
<sites>
|
||||
<site name="Default Web Site" id="1">
|
||||
<application path="/">
|
||||
<virtualDirectory path="/" physicalPath="." />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:50691:localhost" />
|
||||
</bindings>
|
||||
</site>
|
||||
<applicationDefaults applicationPool="DefaultAppPool" />
|
||||
<virtualDirectoryDefaults allowSubDirConfig="true" />
|
||||
</sites>
|
||||
|
||||
<webLimits />
|
||||
|
||||
</system.applicationHost>
|
||||
|
||||
<system.webServer>
|
||||
|
||||
<!--
|
||||
|
||||
The <globalModules> section defines all native-code modules.
|
||||
To enable a module, specify it in the <modules> section.
|
||||
|
||||
-->
|
||||
<globalModules>
|
||||
<add name="UriCacheModule" image="%windir%\System32\inetsrv\cachuri.dll" />
|
||||
<add name="ProtocolSupportModule" image="%windir%\System32\inetsrv\protsup.dll" />
|
||||
<add name="AnonymousAuthenticationModule" image="%windir%\System32\inetsrv\authanon.dll" />
|
||||
<add name="AspNetCoreModuleV2" image="aspnetcorev2.dll" />
|
||||
</globalModules>
|
||||
|
||||
<handlers accessPolicy="Read, Script">
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
|
||||
|
||||
<modules>
|
||||
<add name="AnonymousAuthenticationModule" lockItem="true" />
|
||||
<add name="AspNetCoreModuleV2" lockItem="true" />
|
||||
</modules>
|
||||
|
||||
|
||||
<aspNetCore processPath="" arguments="" hostingModel="inprocess"/>
|
||||
|
||||
</system.webServer>
|
||||
|
||||
</configuration>
|
||||
|
|
@ -6,17 +6,33 @@
|
|||
|
||||
<ItemGroup>
|
||||
<Content Include="AppHostConfig\*.config" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Include="Properties\launchSettings.json">
|
||||
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Server.IIS\Microsoft.AspNetCore.Server.IIS.csproj" />
|
||||
<ProjectReference Include="..\..\src\Microsoft.AspNetCore.Server.IISIntegration\Microsoft.AspNetCore.Server.IISIntegration.csproj" />
|
||||
<ProjectReference Include="..\WebSites\**\*.csproj">
|
||||
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(OS)' == 'Windows_NT'">
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\bin\$(Configuration)\x64\aspnetcorev2_inprocess.dll" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="%(FileName)%(Extension)" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\src\AspNetCoreModuleV2\InProcessRequestHandler\bin\$(Configuration)\x64\aspnetcorev2_inprocess.pdb" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="%(FileName)%(Extension)" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\x64\aspnetcorev2.dll" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="%(FileName)%(Extension)" />
|
||||
<None Include="$(MSBuildThisFileDirectory)..\..\src\AspNetCoreModuleV2\AspNetCore\bin\$(Configuration)\x64\aspnetcorev2.pdb" CopyToOutputDirectory="PreserveNewest" Visible="true" Link="%(FileName)%(Extension)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="AppHostConfig\TestServer.config" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Server.IntegrationTesting" Version="$(MicrosoftAspNetCoreServerIntegrationTestingPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.CommandLineUtils.Sources" Version="$(MicrosoftExtensionsCommandLineUtilsSourcesPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="$(MicrosoftExtensionsLoggingPackageVersion)" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Testing" Version="$(MicrosoftExtensionsLoggingTestingPackageVersion)" />
|
||||
|
|
@ -26,4 +42,10 @@
|
|||
<PackageReference Include="xunit.runner.visualstudio" Version="$(XunitRunnerVisualStudioPackageVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="AppHostConfig\TestServer.config">
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using IISIntegration.FunctionalTests.Utilities;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace IISIntegration.FunctionalTests.Inprocess
|
||||
{
|
||||
[SkipIfHostableWebCoreNotAvailible]
|
||||
public class TestServerTest: LoggedTest
|
||||
{
|
||||
public TestServerTest(ITestOutputHelper output = null) : base(output)
|
||||
{
|
||||
}
|
||||
|
||||
[ConditionalFact]
|
||||
public async Task Test()
|
||||
{
|
||||
var helloWorld = "Hello World";
|
||||
var expectedPath = "/Path";
|
||||
|
||||
string path = null;
|
||||
using (var testServer = await TestServer.Create(ctx => {
|
||||
path = ctx.Request.Path.ToString();
|
||||
return ctx.Response.WriteAsync(helloWorld);
|
||||
}, LoggerFactory))
|
||||
{
|
||||
var result = await testServer.HttpClient.GetAsync(expectedPath);
|
||||
Assert.Equal(helloWorld, await result.Content.ReadAsStringAsync());
|
||||
Assert.Equal(expectedPath, path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
|
||||
namespace IISIntegration.FunctionalTests.Utilities
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method)]
|
||||
public sealed class SkipIfHostableWebCoreNotAvailibleAttribute : Attribute, ITestCondition
|
||||
{
|
||||
public bool IsMet { get; } = File.Exists(TestServer.HostableWebCoreLocation);
|
||||
|
||||
public string SkipReason { get; } = $"Hostable Web Core not availible, {TestServer.HostableWebCoreLocation} not found.";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace IISIntegration.FunctionalTests.Utilities
|
||||
{
|
||||
public class TestServer: IDisposable, IStartup
|
||||
{
|
||||
private const string InProcessHandlerDll = "aspnetcorev2_inprocess.dll";
|
||||
private const string AspNetCoreModuleDll = "aspnetcorev2.dll";
|
||||
private const string HWebCoreDll = "hwebcore.dll";
|
||||
|
||||
internal static string HostableWebCoreLocation => Environment.ExpandEnvironmentVariables($@"%windir%\system32\inetsrv\{HWebCoreDll}");
|
||||
|
||||
private static readonly SemaphoreSlim WebCoreLock = new SemaphoreSlim(1, 1);
|
||||
|
||||
// Currently this is hardcoded in TestServer.config
|
||||
private static readonly int BasePort = 50691;
|
||||
private static readonly Uri BaseUri = new Uri("http://localhost:" + BasePort);
|
||||
|
||||
private readonly TaskCompletionSource<object> _startedTaskCompletionSource = new TaskCompletionSource<object>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
|
||||
private readonly Action<IApplicationBuilder> _appBuilder;
|
||||
private readonly ILoggerFactory _loggerFactory;
|
||||
|
||||
public HttpClient HttpClient { get; }
|
||||
public TestConnection CreateConnection() => new TestConnection(BasePort);
|
||||
|
||||
private IWebHost _host;
|
||||
|
||||
private TestServer(Action<IApplicationBuilder> appBuilder, ILoggerFactory loggerFactory)
|
||||
{
|
||||
_appBuilder = appBuilder;
|
||||
_loggerFactory = loggerFactory;
|
||||
|
||||
HttpClient = new HttpClient(new LoggingHandler(new SocketsHttpHandler(), _loggerFactory.CreateLogger<TestServer>()))
|
||||
{
|
||||
BaseAddress = BaseUri
|
||||
};
|
||||
}
|
||||
|
||||
public static async Task<TestServer> Create(Action<IApplicationBuilder> appBuilder, ILoggerFactory loggerFactory)
|
||||
{
|
||||
await WebCoreLock.WaitAsync();
|
||||
var server = new TestServer(appBuilder, loggerFactory);
|
||||
server.Start();
|
||||
await server.HttpClient.GetAsync("/start");
|
||||
await server._startedTaskCompletionSource.Task;
|
||||
return server;
|
||||
}
|
||||
|
||||
public static Task<TestServer> Create(RequestDelegate app, ILoggerFactory loggerFactory)
|
||||
{
|
||||
return Create(builder => builder.Run(app), loggerFactory);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
LoadLibrary(HostableWebCoreLocation);
|
||||
LoadLibrary(InProcessHandlerDll);
|
||||
LoadLibrary(AspNetCoreModuleDll);
|
||||
|
||||
set_main_handler(Main);
|
||||
var startResult = WebCoreActivate(Path.GetFullPath("AppHostConfig/TestServer.config"), null, "Instance");
|
||||
if (startResult != 0)
|
||||
{
|
||||
throw new InvalidOperationException($"Error while running WebCoreActivate: {startResult}");
|
||||
}
|
||||
}
|
||||
|
||||
private int Main(IntPtr argc, IntPtr argv)
|
||||
{
|
||||
_host = new WebHostBuilder()
|
||||
.UseIIS()
|
||||
.ConfigureServices(services => {
|
||||
services.AddSingleton<IStartup>(this);
|
||||
services.AddSingleton<ILoggerFactory>(_loggerFactory);
|
||||
})
|
||||
.UseSetting(WebHostDefaults.ApplicationKey, typeof(TestServer).GetTypeInfo().Assembly.FullName)
|
||||
.Build();
|
||||
|
||||
var doneEvent = new ManualResetEventSlim();
|
||||
var lifetime = _host.Services.GetService<IApplicationLifetime>();
|
||||
|
||||
lifetime.ApplicationStopping.Register(() => doneEvent.Set());
|
||||
_host.Start();
|
||||
_startedTaskCompletionSource.SetResult(null);
|
||||
doneEvent.Wait();
|
||||
_host.Dispose();
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
HttpClient.Dispose();
|
||||
WebCoreShutdown(false);
|
||||
WebCoreLock.Release();
|
||||
}
|
||||
|
||||
public IServiceProvider ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
return services.BuildServiceProvider();
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
{
|
||||
app.Map("/start", builder => builder.Run(context => context.Response.WriteAsync("Done")));
|
||||
_appBuilder(app);
|
||||
}
|
||||
|
||||
private delegate int hostfxr_main_fn(IntPtr argc, IntPtr argv);
|
||||
|
||||
[DllImport(HWebCoreDll)]
|
||||
private static extern int WebCoreActivate(
|
||||
[In, MarshalAs(UnmanagedType.LPWStr)]
|
||||
string appHostConfigPath,
|
||||
[In, MarshalAs(UnmanagedType.LPWStr)]
|
||||
string rootWebConfigPath,
|
||||
[In, MarshalAs(UnmanagedType.LPWStr)]
|
||||
string instanceName);
|
||||
|
||||
[DllImport(HWebCoreDll)]
|
||||
private static extern int WebCoreShutdown(bool immediate);
|
||||
|
||||
[DllImport(InProcessHandlerDll)]
|
||||
private static extern int set_main_handler(hostfxr_main_fn main);
|
||||
|
||||
[DllImport("kernel32", SetLastError=true, CharSet = CharSet.Ansi)]
|
||||
private static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)] string lpFileName);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue