Custom asynchronous HTTP handlers generate a 500 error in IIS 7.5 Native Mode Only - Why?

I wrote a long survey in ASP.Net. The client side creates an XMLHttpRequest for the page, which is either "any.orders" or "any.prices".

I have several asynchronous custom HTTP handlers that accept the request, subscribe to the request, and serve the data (apparently the page response) at a later point in time.

In Visual Studio Dev, the server works fine, fine. In IIS 7.5 on Windows Server 2008 R2, I can only get it to work in classic mode.

If I switch to Integrated Mode (with request tracing), XMLHttpRequest will get a 500 error from IsapiModule:

ModuleName:IsapiModule 
Notification:128 
HttpStatus:500 
HttpReason:Internal Server Error 
HttpSubStatus:0 
ErrorCode:0 
ConfigExceptionInfo:
Notification:EXECUTE_REQUEST_HANDLER 
ErrorCode:The operation completed successfully. (0x0) 

Async, BeginProcessRequest() . , IsapiModule .

, . , , WebSockets , , , .

web.config :

  <system.web>

    <!-- IIS 6.0/7.0 AsyncHttpHandler Registration -->
    <httpHandlers>

      <add verb="*" path="*.prices" type="AsyncHttpHandlerPrices" />
      <add verb="*" path="*.orders" type="AsyncHttpHandlerOrders" /> 

      <!-- For Copy and Paste into Excel -->
      <add verb="*" path="*.xls" type="System.Web.StaticFileHandler" />
      <add verb="*" path="*.xlsx" type="System.Web.StaticFileHandler" />

    </httpHandlers>

  </system.web>

  <system.webServer>

    <handlers>
    <remove name="svc-Integrated" />
      <remove name="xoml-Integrated" />
      <add name="*.vbhtml_*" path="*.vbhtml" verb="*" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv2.0" />
      <add name="*.vbhtm_*" path="*.vbhtm" verb="*" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv2.0" />
      <add name="*.cshtml_*" path="*.cshtml" verb="*" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv2.0" />
      <add name="*.cshtm_*" path="*.cshtm" verb="*" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv2.0" />
      <add name="*.aspq_*" path="*.aspq" verb="*" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv2.0" />
      <add name="*.xamlx_*" path="*.xamlx" verb="*" type="System.Xaml.Hosting.XamlHttpHandlerFactory, System.Xaml.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv2.0" />
      <add name="*.xoml_*" path="*.xoml" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv2.0" />
      <add name="*.svc_*" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv2.0" />
      <add name="*.soap_*" path="*.soap" verb="*" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv2.0" />
      <add name="*.rem_*" path="*.rem" verb="*" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv2.0" />
      <add name="*.asmx_*" path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv2.0" />
      <add name="ScriptResource.axd_GET,HEAD" path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv2.0" />
      <add name="*_AppService.axd_*" path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv2.0" />
      <add name="eurl.axd_*" path="eurl.axd" verb="*" type="System.Web.HttpNotFoundHandler" preCondition="integratedMode,runtimeVersionv2.0" />
      <add name="*.xlsx_*" path="*.xlsx" verb="*" type="System.Web.StaticFileHandler" preCondition="integratedMode,runtimeVersionv2.0" />
      <add name="*.xls_*" path="*.xls" verb="*" type="System.Web.StaticFileHandler" preCondition="integratedMode,runtimeVersionv2.0" />
      <add verb="*" path="*.prices" name="AsyncHttpHandlerPrices" type="AsyncHttpHandlerPrices" modules="IsapiModule" scriptProcessor="c:\windows\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll" />
      <add verb="*" path="*.orders" name="AsyncHttpHandlerOrders" type="AsyncHttpHandlerOrders" modules="IsapiModule" scriptProcessor="c:\windows\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll" />
    </handlers>
    <modules>
      <remove name="ServiceModel" /> 
      <add name="ErrorHandlerModule" type="System.Web.Mobile.ErrorHandlerModule, System.Web.Mobile, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" preCondition="managedHandler" />
      <add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler" />
    </modules>
    <validation validateIntegratedModeConfiguration="false" />
    <tracing>
      <traceFailedRequests>
        <add path="*.orders">
        <traceAreas>
        <add provider="ASP" verbosity="Verbose" />
        <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
        <add provider="ISAPI Extension" verbosity="Verbose" />
        <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI,Rewrite,RequestRouting" verbosity="Verbose" />
        </traceAreas>
        <failureDefinitions statusCodes="100-999" />
        </add>
        <add path="*.prices">
        <traceAreas>
        <add provider="ASP" verbosity="Verbose" />
        <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
        <add provider="ISAPI Extension" verbosity="Verbose" />
        <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI,Rewrite,RequestRouting" verbosity="Verbose" />
        </traceAreas>
        <failureDefinitions statusCodes="100-999" />
        </add>
      </traceFailedRequests>
    </tracing>
  </system.webServer>

DotNet - 4.0. ​​ .Net( , , ).

+4
1

, web.config. , , :

ASP.NET, .

, ASP.NET web.config 500, , . :

- , ASP.NET .

<configuration>
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
    </system.webServer>
</configuration> 

- . : http://msdn.microsoft.com/library/bb515251.aspx

Update:

, (?). : http://mvolo.com/breaking-changes-for-aspnet-20-applications-running-in-integrated-mode-on-iis-70/

, .

2:

SO- :

HTTP 500.22 - ( ASP.NET, .)

ASP.NET,

+4

Source: https://habr.com/ru/post/1536802/


All Articles