PR comments

This commit is contained in:
Pavel Krymets 2018-04-10 08:30:37 -07:00
parent e32b51d6e6
commit 80e799d17c
3 changed files with 18 additions and 9 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Description>ASP.NET Core components for working with the IIS AspNetCoreModule.</Description> <Description>ASP.NET Core components for working with the IIS AspNetCoreModule.</Description>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFrameworks>netstandard2.0;netcoreapp2.1</TargetFrameworks>
<NoWarn>$(NoWarn);CS1591</NoWarn> <NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageTags>aspnetcore;iis</PackageTags> <PackageTags>aspnetcore;iis</PackageTags>

View File

@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
[DllImport(AspNetCoreModuleDll)] [DllImport(AspNetCoreModuleDll)]
private static extern int http_get_server_variable( private static extern int http_get_server_variable(
IntPtr pInProcessHandler, IntPtr pInProcessHandler,
[MarshalAs(UnmanagedType.AnsiBStr)] string variableName, [MarshalAs(UnmanagedType.LPStr)] string variableName,
[MarshalAs(UnmanagedType.BStr)] out string value); [MarshalAs(UnmanagedType.BStr)] out string value);
[DllImport(AspNetCoreModuleDll)] [DllImport(AspNetCoreModuleDll)]

View File

@ -144,16 +144,25 @@ namespace Microsoft.AspNetCore.Server.IISIntegration
var server = (IISHttpServer)GCHandle.FromIntPtr(pvRequestContext).Target; var server = (IISHttpServer)GCHandle.FromIntPtr(pvRequestContext).Target;
Interlocked.Increment(ref server._outstandingRequests); Interlocked.Increment(ref server._outstandingRequests);
_ = Task.Run( #if NETCOREAPP2_1
async () => { ThreadPool.QueueUserWorkItem<(IISHttpServer, IntPtr)>(
var context = server._iisContextFactory.CreateHttpContext(pInProcessHandler); state => _ = HandleRequest(state.Item1, state.Item2),
var result = await context.ProcessRequestAsync();; (server, pInProcessHandler),
CompleteRequest(context, result); preferLocal: false);
}); #else
ThreadPool.QueueUserWorkItem(
state => _ = HandleRequest(server, pInProcessHandler));
#endif
return NativeMethods.REQUEST_NOTIFICATION_STATUS.RQ_NOTIFICATION_PENDING; return NativeMethods.REQUEST_NOTIFICATION_STATUS.RQ_NOTIFICATION_PENDING;
} }
private static async Task HandleRequest(IISHttpServer server, IntPtr handler)
{
var context = server._iisContextFactory.CreateHttpContext(handler);
var result = await context.ProcessRequestAsync();
CompleteRequest(context, result);
}
private static bool HandleShutdown(IntPtr pvRequestContext) private static bool HandleShutdown(IntPtr pvRequestContext)
{ {
var server = (IISHttpServer)GCHandle.FromIntPtr(pvRequestContext).Target; var server = (IISHttpServer)GCHandle.FromIntPtr(pvRequestContext).Target;