Moves in-process to UseIISIntegration, removes Server.IIS namespace (#443)
This commit is contained in:
parent
d961ada80b
commit
f91a941f8d
|
|
@ -39,8 +39,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7E80C58E
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IISIntegration.FunctionalTests", "test\IISIntegration.FunctionalTests\IISIntegration.FunctionalTests.csproj", "{4E3E1F5C-CD52-4CC0-A35F-D1FA1685D2FA}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IIS", "src\Microsoft.AspNetCore.Server.IIS\Microsoft.AspNetCore.Server.IIS.csproj", "{5C475A6A-8FF6-401F-A35E-01461312C8F6}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NativeIISSample", "samples\NativeIISSample\NativeIISSample.csproj", "{9BC4AFCB-325D-4C81-8228-8CF301CE2F97}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IISTestSite", "test\IISTestSite\IISTestSite.csproj", "{679FA2A2-898B-4320-884E-C2D294A97CE1}"
|
||||
|
|
@ -117,18 +115,6 @@ Global
|
|||
{4E3E1F5C-CD52-4CC0-A35F-D1FA1685D2FA}.Release|x64.Build.0 = Release|Any CPU
|
||||
{4E3E1F5C-CD52-4CC0-A35F-D1FA1685D2FA}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{4E3E1F5C-CD52-4CC0-A35F-D1FA1685D2FA}.Release|x86.Build.0 = Release|Any CPU
|
||||
{5C475A6A-8FF6-401F-A35E-01461312C8F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5C475A6A-8FF6-401F-A35E-01461312C8F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5C475A6A-8FF6-401F-A35E-01461312C8F6}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{5C475A6A-8FF6-401F-A35E-01461312C8F6}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{5C475A6A-8FF6-401F-A35E-01461312C8F6}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{5C475A6A-8FF6-401F-A35E-01461312C8F6}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{5C475A6A-8FF6-401F-A35E-01461312C8F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5C475A6A-8FF6-401F-A35E-01461312C8F6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5C475A6A-8FF6-401F-A35E-01461312C8F6}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{5C475A6A-8FF6-401F-A35E-01461312C8F6}.Release|x64.Build.0 = Release|Any CPU
|
||||
{5C475A6A-8FF6-401F-A35E-01461312C8F6}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{5C475A6A-8FF6-401F-A35E-01461312C8F6}.Release|x86.Build.0 = Release|Any CPU
|
||||
{9BC4AFCB-325D-4C81-8228-8CF301CE2F97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9BC4AFCB-325D-4C81-8228-8CF301CE2F97}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9BC4AFCB-325D-4C81-8228-8CF301CE2F97}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
|
|
@ -174,7 +160,6 @@ Global
|
|||
{4106DB10-E09F-480E-9CE6-B39235512EE6} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||
{F54715C3-88D8-49E3-A291-C13570FE81FC} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||
{4E3E1F5C-CD52-4CC0-A35F-D1FA1685D2FA} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||
{5C475A6A-8FF6-401F-A35E-01461312C8F6} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD}
|
||||
{9BC4AFCB-325D-4C81-8228-8CF301CE2F97} = {C74B8F36-FD2F-45C9-9B8A-00E7CF0126A9}
|
||||
{679FA2A2-898B-4320-884E-C2D294A97CE1} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||
{C745BBFD-7888-4038-B41B-6D1832D13878} = {EF30B533-D715-421A-92B7-92FEF460AC9C}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
<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" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -5,9 +5,6 @@ using System.Threading.Tasks;
|
|||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Server.IIS;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace NativeIISSample
|
||||
{
|
||||
|
|
@ -66,7 +63,7 @@ namespace NativeIISSample
|
|||
public static void Main(string[] args)
|
||||
{
|
||||
var host = new WebHostBuilder()
|
||||
.UseNativeIIS()
|
||||
.UseIISIntegration()
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
|
|
|
|||
|
|
@ -977,11 +977,6 @@
|
|||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" forwardWindowsAuthToken="false" stdoutLogEnabled="false" hostingModel="inprocess"/>
|
||||
<httpCompression>
|
||||
<dynamicCompression>
|
||||
<add mimeType="text/event-stream" enabled="false" />
|
||||
</dynamicCompression>
|
||||
</httpCompression>
|
||||
</system.webServer>
|
||||
</location>
|
||||
</configuration>
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>ASP.NET Core components for running the in process mode for AspNetCoreModule.</Description>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageTags>aspnetcore;iis</PackageTags>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Security.Principal.Windows" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.HttpSys.Sources" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.AspNetCore.HttpSys.Internal;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.IIS
|
||||
{
|
||||
public static class NativeMethods
|
||||
{
|
||||
public const int S_OK = 0;
|
||||
private const string AspNetCoreModuleDll = "aspnetcore.dll";
|
||||
|
||||
public enum REQUEST_NOTIFICATION_STATUS
|
||||
{
|
||||
RQ_NOTIFICATION_CONTINUE,
|
||||
RQ_NOTIFICATION_PENDING,
|
||||
RQ_NOTIFICATION_FINISH_REQUEST
|
||||
}
|
||||
|
||||
public delegate REQUEST_NOTIFICATION_STATUS PFN_REQUEST_HANDLER(IntPtr pHttpContext, IntPtr pvRequestContext);
|
||||
public delegate bool PFN_SHUTDOWN_HANDLER(IntPtr pvRequestContext);
|
||||
public delegate REQUEST_NOTIFICATION_STATUS PFN_ASYNC_COMPLETION(IntPtr pHttpContext, IntPtr completionInfo, IntPtr pvCompletionContext);
|
||||
|
||||
// TODO make this all internal
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public static extern int http_post_completion(IntPtr pHttpContext, int cbBytes);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public static extern void http_indicate_completion(IntPtr pHttpContext, REQUEST_NOTIFICATION_STATUS notificationStatus);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public static extern void register_callbacks(PFN_REQUEST_HANDLER request_callback, PFN_SHUTDOWN_HANDLER shutdown_callback, IntPtr pvRequestContext, IntPtr pvShutdownContext);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
internal unsafe static extern int http_write_response_bytes(IntPtr pHttpContext, HttpApiTypes.HTTP_DATA_CHUNK* pDataChunks, int nChunks, PFN_ASYNC_COMPLETION pfnCompletionCallback, IntPtr pvCompletionContext, out bool fCompletionExpected);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public unsafe static extern int http_flush_response_bytes(IntPtr pHttpContext, PFN_ASYNC_COMPLETION pfnCompletionCallback, IntPtr pvCompletionContext, out bool fCompletionExpected);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
internal unsafe static extern HttpApiTypes.HTTP_REQUEST_V2* http_get_raw_request(IntPtr pHttpContext);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
internal unsafe static extern HttpApiTypes.HTTP_RESPONSE_V2* http_get_raw_response(IntPtr pHttpContext);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public unsafe static extern void http_set_response_status_code(IntPtr pHttpContext, ushort statusCode, byte* pszReason);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public unsafe static extern int http_read_request_bytes(IntPtr pHttpContext, byte* pvBuffer, int cbBuffer, PFN_ASYNC_COMPLETION pfnCompletionCallback, IntPtr pvCompletionContext, out int dwBytesReceived, out bool fCompletionExpected);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public unsafe static extern bool http_get_completion_info(IntPtr pCompletionInfo, out int cbBytes, out int hr);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
[return: MarshalAs(UnmanagedType.BStr)]
|
||||
public unsafe static extern string http_get_application_full_path();
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public unsafe static extern bool http_shutdown();
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
public static extern IntPtr GetModuleHandle(string lpModuleName);
|
||||
|
||||
public static bool is_ancm_loaded()
|
||||
{
|
||||
return GetModuleHandle(AspNetCoreModuleDll) != IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>ASP.NET Core components for working with the IIS AspNetCoreModule.</Description>
|
||||
|
|
@ -6,18 +6,26 @@
|
|||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageTags>aspnetcore;iis</PackageTags>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Numerics.Vectors" />
|
||||
<PackageReference Include="System.Buffers" />
|
||||
<PackageReference Include="System.IO.Pipelines" />
|
||||
<PackageReference Include="System.Text.Encodings.Web.Utf8" />
|
||||
<PackageReference Include="System.Memory" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
|
||||
<PackageReference Include="System.Security.Principal.Windows" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Core" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.HttpOverrides" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.HttpSys.Sources" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options" />
|
||||
<PackageReference Include="Microsoft.Extensions.SecurityHelper.Sources" PrivateAssets="All" />
|
||||
<PackageReference Include="System.Security.Principal.Windows" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.AspNetCore.HttpSys.Internal;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.IISIntegration
|
||||
{
|
||||
|
|
@ -20,5 +21,65 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
|
|||
[DllImport(KERNEL32, ExactSpelling = true, SetLastError = true)]
|
||||
#endif
|
||||
internal static extern bool CloseHandle(IntPtr handle);
|
||||
|
||||
public const int S_OK = 0;
|
||||
private const string AspNetCoreModuleDll = "aspnetcore.dll";
|
||||
|
||||
public enum REQUEST_NOTIFICATION_STATUS
|
||||
{
|
||||
RQ_NOTIFICATION_CONTINUE,
|
||||
RQ_NOTIFICATION_PENDING,
|
||||
RQ_NOTIFICATION_FINISH_REQUEST
|
||||
}
|
||||
|
||||
public delegate REQUEST_NOTIFICATION_STATUS PFN_REQUEST_HANDLER(IntPtr pHttpContext, IntPtr pvRequestContext);
|
||||
public delegate bool PFN_SHUTDOWN_HANDLER(IntPtr pvRequestContext);
|
||||
public delegate REQUEST_NOTIFICATION_STATUS PFN_ASYNC_COMPLETION(IntPtr pHttpContext, IntPtr completionInfo, IntPtr pvCompletionContext);
|
||||
|
||||
// TODO make this all internal
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public static extern int http_post_completion(IntPtr pHttpContext, int cbBytes);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public static extern void http_indicate_completion(IntPtr pHttpContext, REQUEST_NOTIFICATION_STATUS notificationStatus);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public static extern void register_callbacks(PFN_REQUEST_HANDLER request_callback, PFN_SHUTDOWN_HANDLER shutdown_callback, IntPtr pvRequestContext, IntPtr pvShutdownContext);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
internal unsafe static extern int http_write_response_bytes(IntPtr pHttpContext, HttpApiTypes.HTTP_DATA_CHUNK* pDataChunks, int nChunks, PFN_ASYNC_COMPLETION pfnCompletionCallback, IntPtr pvCompletionContext, out bool fCompletionExpected);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public unsafe static extern int http_flush_response_bytes(IntPtr pHttpContext, PFN_ASYNC_COMPLETION pfnCompletionCallback, IntPtr pvCompletionContext, out bool fCompletionExpected);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
internal unsafe static extern HttpApiTypes.HTTP_REQUEST_V2* http_get_raw_request(IntPtr pHttpContext);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
internal unsafe static extern HttpApiTypes.HTTP_RESPONSE_V2* http_get_raw_response(IntPtr pHttpContext);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public unsafe static extern void http_set_response_status_code(IntPtr pHttpContext, ushort statusCode, byte* pszReason);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public unsafe static extern int http_read_request_bytes(IntPtr pHttpContext, byte* pvBuffer, int cbBuffer, PFN_ASYNC_COMPLETION pfnCompletionCallback, IntPtr pvCompletionContext, out int dwBytesReceived, out bool fCompletionExpected);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public unsafe static extern bool http_get_completion_info(IntPtr pCompletionInfo, out int cbBytes, out int hr);
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
[return: MarshalAs(UnmanagedType.BStr)]
|
||||
public unsafe static extern string http_get_application_full_path();
|
||||
|
||||
[DllImport(AspNetCoreModuleDll)]
|
||||
public unsafe static extern bool http_shutdown();
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
public static extern IntPtr GetModuleHandle(string lpModuleName);
|
||||
|
||||
public static bool is_ancm_loaded()
|
||||
{
|
||||
return GetModuleHandle(AspNetCoreModuleDll) != IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using System.IO;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.IIS
|
||||
namespace Microsoft.AspNetCore.Server.IISIntegration
|
||||
{
|
||||
// TODO redudant file, remove
|
||||
// See https://github.com/aspnet/IISIntegration/issues/426
|
||||
|
|
@ -14,7 +14,7 @@ using Microsoft.AspNetCore.Http.Features;
|
|||
using Microsoft.AspNetCore.WebUtilities;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.IIS
|
||||
namespace Microsoft.AspNetCore.Server.IISIntegration
|
||||
{
|
||||
internal partial class HttpProtocol : IFeatureCollection,
|
||||
IHttpRequestFeature,
|
||||
|
|
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.IIS
|
||||
namespace Microsoft.AspNetCore.Server.IISIntegration
|
||||
{
|
||||
internal partial class HttpProtocol
|
||||
{
|
||||
|
|
@ -18,7 +18,7 @@ using Microsoft.AspNetCore.HttpSys.Internal;
|
|||
using Microsoft.AspNetCore.WebUtilities;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.IIS
|
||||
namespace Microsoft.AspNetCore.Server.IISIntegration
|
||||
{
|
||||
internal abstract partial class HttpProtocol : NativeRequestContext, IDisposable
|
||||
{
|
||||
|
|
@ -8,10 +8,10 @@ using System.Runtime.InteropServices;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.IIS
|
||||
namespace Microsoft.AspNetCore.Server.IISIntegration
|
||||
{
|
||||
// Primarily copied from https://github.com/aspnet/KestrelHttpServer/blob/dev/src/Kestrel.Transport.Libuv/Internal/LibuvAwaitable.cs
|
||||
public class IISAwaitable : ICriticalNotifyCompletion
|
||||
internal class IISAwaitable : ICriticalNotifyCompletion
|
||||
{
|
||||
private readonly static Action _callbackCompleted = () => { };
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Hosting.Server;
|
|||
using System.Threading;
|
||||
using System.IO.Pipelines;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.IIS
|
||||
namespace Microsoft.AspNetCore.Server.IISIntegration
|
||||
{
|
||||
internal class IISHttpContextOfT<TContext> : HttpProtocol
|
||||
{
|
||||
|
|
@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.IIS
|
||||
namespace Microsoft.AspNetCore.Server.IISIntegration
|
||||
{
|
||||
internal class IISHttpRequestBody : Stream
|
||||
{
|
||||
|
|
@ -6,7 +6,7 @@ using System.IO;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.IIS
|
||||
namespace Microsoft.AspNetCore.Server.IISIntegration
|
||||
{
|
||||
internal class IISHttpResponseBody : Stream
|
||||
{
|
||||
|
|
@ -11,9 +11,9 @@ using Microsoft.AspNetCore.Hosting.Server;
|
|||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.IIS
|
||||
namespace Microsoft.AspNetCore.Server.IISIntegration
|
||||
{
|
||||
public class IISHttpServer : IServer
|
||||
internal class IISHttpServer : IServer
|
||||
{
|
||||
private static NativeMethods.PFN_REQUEST_HANDLER _requestHandler = HandleRequest;
|
||||
private static NativeMethods.PFN_SHUTDOWN_HANDLER _shutdownHandler = HandleShutdown;
|
||||
|
|
@ -122,25 +122,4 @@ namespace Microsoft.AspNetCore.Server.IIS
|
|||
{
|
||||
HttpProtocol CreateHttpContext(IntPtr pHttpContext);
|
||||
}
|
||||
|
||||
public static class WebHostBuilderExtensions
|
||||
{
|
||||
public static IWebHostBuilder UseNativeIIS(this IWebHostBuilder builder)
|
||||
{
|
||||
if (NativeMethods.is_ancm_loaded())
|
||||
{
|
||||
// TODO put this in options and use path.
|
||||
var path = NativeMethods.http_get_application_full_path();
|
||||
builder.UseContentRoot(path);
|
||||
return builder.ConfigureServices(services =>
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
services.AddSingleton<IServer, IISHttpServer>();
|
||||
}
|
||||
});
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6,9 +6,9 @@ using System.IO.Pipelines;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.IIS
|
||||
namespace Microsoft.AspNetCore.Server.IISIntegration
|
||||
{
|
||||
public class OutputProducer
|
||||
internal class OutputProducer
|
||||
{
|
||||
private static readonly ArraySegment<byte> _emptyData = new ArraySegment<byte>(new byte[0]);
|
||||
|
||||
|
|
@ -2,13 +2,13 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.Server.IISIntegration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.AspNetCore.Hosting.Server;
|
||||
|
||||
namespace Microsoft.AspNetCore.Hosting
|
||||
{
|
||||
|
|
@ -39,6 +39,21 @@ namespace Microsoft.AspNetCore.Hosting
|
|||
return hostBuilder;
|
||||
}
|
||||
|
||||
// Check if in process
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && NativeMethods.is_ancm_loaded())
|
||||
{
|
||||
hostBuilder.UseSetting(nameof(UseIISIntegration), "true");
|
||||
hostBuilder.CaptureStartupErrors(true);
|
||||
|
||||
var applicationPath = NativeMethods.http_get_application_full_path();
|
||||
hostBuilder.UseContentRoot(applicationPath);
|
||||
return hostBuilder.ConfigureServices(services =>
|
||||
{
|
||||
services.AddSingleton<IServer, IISHttpServer>();
|
||||
services.AddAuthenticationCore();
|
||||
});
|
||||
}
|
||||
|
||||
var port = hostBuilder.GetSetting(ServerPort) ?? Environment.GetEnvironmentVariable($"ASPNETCORE_{ServerPort}");
|
||||
var path = hostBuilder.GetSetting(ServerPath) ?? Environment.GetEnvironmentVariable($"ASPNETCORE_{ServerPath}");
|
||||
var pairingToken = hostBuilder.GetSetting(PairingToken) ?? Environment.GetEnvironmentVariable($"ASPNETCORE_{PairingToken}");
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<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" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<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" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Server.IIS;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace IISTestSite
|
||||
|
|
@ -17,7 +16,7 @@ namespace IISTestSite
|
|||
factory.AddConsole();
|
||||
factory.AddFilter("Console", level => level >= LogLevel.Information);
|
||||
})
|
||||
.UseNativeIIS()
|
||||
.UseIISIntegration()
|
||||
.UseStartup("IISTestSite")
|
||||
.Build();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue