Question

I've written a long-polling project in ASP.Net. The client side makes an XMLHttpRequest for a page that is either "any.orders" or "any.prices".

I have a couple of asynchronous custom http handlers that take the request, perform subscription for the request, and serve up data (notionally, the page response) at a later point in time.

In Visual Studio's Dev server, it works fine, perfect. 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), the XMLHttpRequest gets an Error 500 from the 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) 

In the application logs, I can see an instance of the Async handler class being created, but the BeginProcessRequest() function is not called. It is almost as if the IsapiModule is immediately batting back the zero return code without handling the page request.

I have been driving myself nutty trying to get it working in Integrated Mode. I know long-polling's days are numbered, as WebSockets is near standard, but if I could clear this up it would help my understanding of what is going on.

The web.config sections for handler registration are below:

  <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 version is 4.0. The .Net Extensibility feature is installed (as said, it works in Classic mode, so it must be good).

Was it helpful?

Solution

The problem is that you cannot switch from Classic Mode to Integrated Mode without the appropiated changes in the web.config. If I am on the right way, this has to be the error that you receive:

An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.

Basically, ASP.NET verifies the proper configuration in the web.config and returns a 500 error if the config file has settings that do not apply. You have two ways to do it:

The first way is to disable the validations that ASP.NET performes to verify the configuration for Integrated Mode.

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

The second one is to migrate the config settings. This document will be useful: http://msdn.microsoft.com/library/bb515251.aspx

Update:

I was focused on the problem and not in your question (why?). Here you have why: http://mvolo.com/breaking-changes-for-aspnet-20-applications-running-in-integrated-mode-on-iis-70/

I hope you find it useful

Update 2:

Here you have two SO questions and their very good answers about the same problem:

HTTP Error 500.22 - Internal Server Error (An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.)

An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top